X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=plugins%2Fdali-script-v8%2Fsrc%2Fmodule-loader%2Fmodule-loader.cpp;h=9255574b3451f830e4633fb5fa910b228e3230fe;hb=87b87263ddda2188a86217cca356932e36e4cd94;hp=d475c9088a561f7bb293c18bfcca8009592bc7c7;hpb=2d1ba388f9a941d273e95d729b9662cc1cdad822;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/plugins/dali-script-v8/src/module-loader/module-loader.cpp b/plugins/dali-script-v8/src/module-loader/module-loader.cpp index d475c90..9255574 100644 --- a/plugins/dali-script-v8/src/module-loader/module-loader.cpp +++ b/plugins/dali-script-v8/src/module-loader/module-loader.cpp @@ -18,6 +18,9 @@ // CLASS HEADER #include "module-loader.h" +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include @@ -29,7 +32,6 @@ namespace V8Plugin ModuleLoader::ModuleLoader() { - } ModuleLoader::~ModuleLoader() @@ -106,7 +108,7 @@ bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate, } /** - * ### var module = require("module-name"); + * ### var module = require("moduleName"); * * * There is no standard for modules or the 'require' keyword in JavaScript.
@@ -162,7 +164,7 @@ bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate, * 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"); } * *
* @@ -174,23 +176,24 @@ bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate, * #### Exporting as a constructor * * - * // ImageActor.js - * function ImageActor( position, orientation, image, name ) + * // ImageView.js + * function ImageView( position, orientation, image, name ) * { - * this = new dali.ImageActor( image ); + * this = new dali.Control("ImageView"); + * this.image = image; * this.position = position; * this.orientation = orientation; * this.name = name; * } - * module.exports = ImageActor; + * module.exports = ImageView; * *
* * // main.js * - * var ImageActor = require(" ImageActor.js"); + * var ImageView = require(" ImageView.js"); * - * var imageActor = new ImageActor( position, orientation, image, "my first image actor"); + * var imageView = new ImageView( position, orientation, image, "my first image actor"); * * #### Exporting as a singleton * @@ -311,9 +314,7 @@ bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate, * @for ModuleLoader * */ -void ModuleLoader::Require(const v8::FunctionCallbackInfo< v8::Value >& args, - - v8::Persistent& globalObjectTemplate ) +void ModuleLoader::Require(const v8::FunctionCallbackInfo< v8::Value >& args ) { v8::Isolate* isolate = args.GetIsolate(); v8::HandleScope handleScope( isolate ); @@ -393,6 +394,12 @@ void ModuleLoader::Require(const v8::FunctionCallbackInfo< v8::Value >& args, args.GetReturnValue().Set( moduleExports ); } + +void ModuleLoader::StorePreBuiltModule( v8::Isolate* isolate, v8::Local& exportObject, const std::string& name ) +{ + StoreModule( "", name, name, isolate, exportObject ); +} + void ModuleLoader::StoreScriptInfo( const std::string& sourceFileName ) { V8Utils::GetFileDirectory( sourceFileName, mCurrentScriptPath);