ModuleLoader::ModuleLoader()
{
-
}
ModuleLoader::~ModuleLoader()
V8Utils::GetFileContents( fileName, contents );
+ if( contents.empty() )
+ {
+ return false;
+ }
+
return ExecuteScript( isolate, contents, fileName );
}
/**
- * ### var module = require("module-name");
+ * ### var module = require("moduleName");
*
*
* There is no standard for modules or the 'require' keyword in JavaScript.<br />
* from an object literal with name-value pairs (exports object) to a function.
*
* // my_first_module.js
- * module.exports = function() { log("hello-world"); }
+ * module.exports = function() { log("helloWorld"); }
*
* <br />
*
*
*
* // ImageActor.js
- * function ImageActor( position, rotation, image, name )
+ * function ImageActor( position, orientation, image, name )
* {
* this = new dali.ImageActor( image );
* this.position = position;
- * this.rotation = rotation;
+ * this.orientation = orientation;
* this.name = name;
* }
* module.exports = ImageActor;
*
* var ImageActor = require(" ImageActor.js");
*
- * var imageActor = new ImageActor( position, rotation, image, "my first image actor");
+ * var imageActor = new ImageActor( position, orientation, image, "my first image actor");
*
* #### Exporting as a singleton
*
* @for ModuleLoader
*
*/
-void ModuleLoader::Require(const v8::FunctionCallbackInfo< v8::Value >& args,
-
- v8::Persistent<v8::ObjectTemplate>& globalObjectTemplate )
+void ModuleLoader::Require(const v8::FunctionCallbackInfo< v8::Value >& args )
{
v8::Isolate* isolate = args.GetIsolate();
v8::HandleScope handleScope( isolate );
args.GetReturnValue().Set( moduleExports );
}
+
+void ModuleLoader::StorePreBuiltModule( v8::Isolate* isolate, v8::Local<v8::Object>& exportObject, const std::string& name )
+{
+ StoreModule( "", name, name, isolate, exportObject );
+}
+
void ModuleLoader::StoreScriptInfo( const std::string& sourceFileName )
{
V8Utils::GetFileDirectory( sourceFileName, mCurrentScriptPath);