@Override public void onModuleLoad() { if (!isGrowlPresent()) { ScriptInjector.fromString(GrowlClientBundle.INSTANCE.growlJS().getText()) .setWindow(ScriptInjector.TOP_WINDOW) .inject(); } }
/** {@inheritDoc} */ @Override public void setLanguage(final DatePickerLanguage language) { this.language = language; // Inject the JS for the language if (language.getJs() != null) { ScriptInjector.fromString(language.getJs().getText()) .setWindow(ScriptInjector.TOP_WINDOW) .inject(); } }
public void ensureWebComponentApi(ScheduledCommand onLoaded) { // Check if document.register exists if (JsSupport.doc().registerElement() == null) { // Nope... Lets inject our polyfill ScriptInjector.fromUrl(getPolyfillUrl()) .setCallback(voidCallback(onLoaded)) .setRemoveTag(true) .inject(); } else { Scheduler.get().scheduleDeferred(onLoaded); } }
/** Main class */ public void onModuleLoad() { ScriptInjector.fromUrl("https://www.google.com/recaptcha/api/js/recaptcha_ajax.js") .setCallback( new Callback<Void, Exception>() { public void onFailure(Exception reason) { Window.alert("Script load failed."); } public void onSuccess(Void result) { loadModule(); } }) .setWindow(ScriptInjector.TOP_WINDOW) .inject(); }
public static void loadRaphaelFrom(final Listener l, String url) { if (raphaelLoaded) { l.loaded(null); } else { ScriptInjector.fromUrl(url) .setWindow(ScriptInjector.TOP_WINDOW) .setCallback( new com.google.gwt.core.client.Callback<Void, Exception>() { @Override public void onSuccess(Void result) { l.loaded(null); } @Override public void onFailure(Exception reason) { l.loaded(reason); } }) .inject(); } }
@Override public void onModuleLoad() { ScriptInjector.fromString(SelectClientBundle.INSTANCE.selectJs().getText()) .setWindow(ScriptInjector.TOP_WINDOW) .inject(); }
@Override public void onModuleLoad() { ScriptInjector.fromString(Resources.INSTANCE.introJs().getText()) .setWindow(ScriptInjector.TOP_WINDOW) .inject(); }