classafDuvet::ScriptTagBuilder
sys::Obj afDuvet::ScriptTagBuilder
Defines a <script>
tag to be injected into the bottom of your body.
@see https://developer.mozilla.org/en/docs/Web/HTML/Element/script
- async
ScriptTagBuilder async()
Sets the
async
attribute toasync
; the XHTML value, accepted by HTML. Returnsthis
.- defer
ScriptTagBuilder defer()
Sets the
defer
attribute totrue
. Returnsthis
.- fromExternalUrl
ScriptTagBuilder fromExternalUrl(Uri scriptUrl)
Sets the
src
attribute to an external URL. Returnsthis
.- fromLocalUrl
ScriptTagBuilder fromLocalUrl(Uri scriptUrl)
Sets the
src
attribute to a local URL. The URL must be mapped by BedSheet'sFileHandler
service. The URL is rebuilt to take advantage of any asset caching strategies, such as Cold Feet. Returnsthis
.- fromServerFile
ScriptTagBuilder fromServerFile(File scriptFile)
Creates a
src
URL attribute from the given file. The file must exist on the file system and be mapped by BedSheet'sFileHandler
service. The URL is built to take advantage of any asset caching strategies, such as Cold Feet. Returnsthis
.- getAttr
Returns an attribute value on the
<script>
element.- setAttr
ScriptTagBuilder setAttr(Str name, Str value)
Sets an arbitrary attribute on the
<script>
element.- withId
ScriptTagBuilder withId(Str id)
Sets the
id
attribute. Returnsthis
.- withScript
ScriptTagBuilder withScript(Str script)
Sets the contents of the script tag. Returns
this
.- withType
ScriptTagBuilder withType(MimeType type)
Sets the
type
attribute. Returnsthis
.