Search in sources :

Example 1 with RequirejsConfig

use of org.eclipse.che.plugin.requirejs.ide.conf.RequirejsConfig in project che by eclipse.

the class RequireJsLoader method require.

public void require(final Callback<JavaScriptObject[], Throwable> callback, final String[] requiredScripts, final String[] moduleKeys) {
    // require with default config
    final RequirejsConfig defaultConfig = RequirejsConfig.create();
    /** Using GWT.getModuleBaseForStaticFiles() blocks CodeMirror to run under Super Dev Mode */
    defaultConfig.setBaseUrl(GWT.getModuleBaseURL());
    defaultConfig.setWaitSeconds(0);
    require(new RequirejsCallback() {

        @Override
        public void onReady(final JsArray<RequirejsModule> modules) {
            final JavaScriptObject[] result = new JavaScriptObject[modules.length()];
            for (int i = 0; i < modules.length(); i++) {
                result[i] = modules.get(i);
            }
            callback.onSuccess(result);
        }
    }, new RequirejsErrorHandler() {

        @Override
        public void onError(final RequireError error) {
            callback.onFailure(new JavaScriptException(error));
        }
    }, defaultConfig, requiredScripts, moduleKeys);
}
Also used : RequirejsConfig(org.eclipse.che.plugin.requirejs.ide.conf.RequirejsConfig) JavaScriptException(com.google.gwt.core.client.JavaScriptException)

Aggregations

JavaScriptException (com.google.gwt.core.client.JavaScriptException)1 RequirejsConfig (org.eclipse.che.plugin.requirejs.ide.conf.RequirejsConfig)1