Class ScriptInjector.FromString

java.lang.Object
com.google.gwt.core.client.ScriptInjector.FromString
Enclosing class:
ScriptInjector

public static class ScriptInjector.FromString extends Object
Builder for directly injecting a script body into the DOM.
  • Constructor Details

    • FromString

      public FromString(String scriptBody)
      Parameters:
      scriptBody - The script text to install into the document.
  • Method Details

    • inject

      public JavaScriptObject inject()
      Injects a script into the DOM. The JavaScript is evaluated and will be available immediately when this call returns. By default, the script is installed in the same window that the GWT code is installed in.
      Returns:
      the script element created for the injection. Note that it may be removed from the DOM.
    • setRemoveTag

      public ScriptInjector.FromString setRemoveTag(boolean removeTag)
      Parameters:
      removeTag - If true, remove the tag immediately after injecting the source. This shrinks the DOM, possibly at the expense of readability if you are debugging javaScript. Default value is true.
    • setWindow

      public ScriptInjector.FromString setWindow(JavaScriptObject window)
      Parameters:
      window - Specify which window to use to install the script. If not specified, the top current window GWT is loaded in is used.