X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=plugins%2Fdali-script-v8%2Fsrc%2Fmodule-loader%2Fmodule-loader.cpp;h=12ad13c485548e352519ab6c0c95d7cde52fb663;hp=c9d58ea3fc4c13c1e5315b3caa12dcc277d096e6;hb=9c6ea1aa6babb4e6e1c59187cad13b44e0639662;hpb=4c85a797e24c20bfb1670c079e5f66a9a5d6fa0e 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 c9d58ea..12ad13c 100644 --- a/plugins/dali-script-v8/src/module-loader/module-loader.cpp +++ b/plugins/dali-script-v8/src/module-loader/module-loader.cpp @@ -29,7 +29,6 @@ namespace V8Plugin ModuleLoader::ModuleLoader() { - } ModuleLoader::~ModuleLoader() @@ -97,6 +96,11 @@ bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate, V8Utils::GetFileContents( fileName, contents ); + if( contents.empty() ) + { + return false; + } + return ExecuteScript( isolate, contents, fileName ); } @@ -170,11 +174,11 @@ bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate, * * * // 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; @@ -185,7 +189,7 @@ bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate, * * 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 * @@ -306,9 +310,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 ); @@ -388,6 +390,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);