Package com.google.gwt.core.client

## Class ScriptInjector.FromString

- java.lang.Object
- - com.google.gwt.core.client.ScriptInjector.FromString

- Enclosing class:
    ScriptInjector

      public static class ScriptInjector.FromString
      extends java.lang.Object

  Builder for directly injecting a script body into the DOM.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FromString​(java.lang.String scriptBody)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `JavaScriptObject` | `inject()` | Injects a script into the DOM.
    `ScriptInjector.FromString` | `setRemoveTag​(boolean removeTag)` |
    `ScriptInjector.FromString` | `setWindow​(JavaScriptObject window)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FromString

          public FromString​(java.lang.String scriptBody)

      Parameters:
        `scriptBody` - The script text to install into the document.

  - ### Method Detail

    - #### 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.