javascript/lib/core/kirin-webview.js
function resolveModule(moduleName) {
    if (loadedObjects[moduleName]) {
        return loadedObjects[moduleName];
    }
    var aModule, anObject, MyModule;
    if (gwtClasses) {
        aModule = gwtClasses[moduleName];
    }
    if (!aModule) {
        try {
            aModule = myRequire(moduleName);
        } catch (e) {
            // we don't need to do anymore, 
            // as require will have reported the problem
        }
    }
    
    if (aModule) {
        if (typeof aModule === 'function') {
            MyModule = aModule;
            anObject = new MyModule();
        } else {
            anObject = aModule;
        }
        loadedObjects[moduleName] = anObject;
        return anObject;
    }
    
    // we've tried require, and gwt modules.
    // require() will have reported the error already.
    //throw new Error("Cannot load module " + moduleName);
}
function resolveModule(moduleName) {
    if (loadedObjects[moduleName]) {
        return loadedObjects[moduleName];
    }
    var aModule, anObject, MyModule;
    if (gwtClasses) {
        aModule = gwtClasses[moduleName];
    }
    if (!aModule) {
        try {
            aModule = myRequire(moduleName);
        } catch (e) {
            // we don't need to do anymore, 
            // as require will have reported the problem
        }
    }
    
    if (aModule) {
        if (typeof aModule === 'function') {
            MyModule = aModule;
            anObject = new MyModule();
        } else {
            anObject = aModule;
        }
        loadedObjects[moduleName] = anObject;
        return anObject;
    }
    
    // we've tried require, and gwt modules.
    // require() will have reported the error already.
    //throw new Error("Cannot load module " + moduleName);
}
function resolveModule ( moduleName ) { if ( loadedObjects [ moduleName ] ) { return loadedObjects [ moduleName ] ; } var aModule , anObject , MyModule ; if ( gwtClasses ) { aModule = gwtClasses [ moduleName ] ; } if ( ! aModule ) { try { aModule = myRequire ( moduleName ) ; } catch ( e ) { // we don't need to do anymore,  // as require will have reported the problem } } if ( aModule ) { if ( typeof aModule === 'function' ) { MyModule = aModule ; anObject = new MyModule ( ) ; } else { anObject = aModule ; } loadedObjects [ moduleName ] = anObject ; return anObject ; } // we've tried require, and gwt modules. // require() will have reported the error already. //throw new Error("Cannot load module " + moduleName); }
Finds the named module.

It tries quite hard to do this, looking at where gwtClasses may be stashed, and the browserify.require mechanism.

If the resulting object is a function, then it is assumed that the function is a constructor, and an object is newed.

Once we have an object to return, we keep it around as a cache. This is to preserve the require-like semantics,
and also to allow multiple calls to the same object from native.

@param moduleName
@returns anObject.
Finds the named module .