projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[dali_1.1.35] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git]
/
plugins
/
dali-script-v8
/
src
/
module-loader
/
module-loader.cpp
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
..
9255574
100644
(file)
--- 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"
// CLASS HEADER
#include "module-loader.h"
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/vector-wrapper.h>
+
// INTERNAL INCLUDES
#include <v8-utils.h>
// INTERNAL INCLUDES
#include <v8-utils.h>
@@
-29,7
+32,6
@@
namespace V8Plugin
ModuleLoader::ModuleLoader()
{
ModuleLoader::ModuleLoader()
{
-
}
ModuleLoader::~ModuleLoader()
}
ModuleLoader::~ModuleLoader()
@@
-97,11
+99,16
@@
bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate,
V8Utils::GetFileContents( fileName, contents );
V8Utils::GetFileContents( fileName, contents );
+ if( contents.empty() )
+ {
+ return false;
+ }
+
return ExecuteScript( isolate, contents, fileName );
}
/**
return ExecuteScript( isolate, contents, fileName );
}
/**
- * ### var module = require("module
-n
ame");
+ * ### var module = require("module
N
ame");
*
*
* There is no standard for modules or the 'require' keyword in JavaScript.<br />
*
*
* There is no standard for modules or the 'require' keyword in JavaScript.<br />
@@
-157,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
* from an object literal with name-value pairs (exports object) to a function.
*
* // my_first_module.js
- * module.exports = function() { log("hello
-w
orld"); }
+ * module.exports = function() { log("hello
W
orld"); }
*
* <br />
*
*
* <br />
*
@@
-169,23
+176,24
@@
bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate,
* #### Exporting as a constructor
*
*
* #### Exporting as a constructor
*
*
- * // Image
Actor
.js
- * function Image
Actor( position, ro
tation, image, name )
+ * // Image
View
.js
+ * function Image
View( position, orien
tation, image, name )
* {
* {
- * this = new dali.ImageActor( image );
+ * this = new dali.Control("ImageView");
+ * this.image = image;
* this.position = position;
* this.position = position;
- * this.
rotation = ro
tation;
+ * this.
orientation = orien
tation;
* this.name = name;
* }
* this.name = name;
* }
- * module.exports = Image
Actor
;
+ * module.exports = Image
View
;
*
* <br />
*
* // main.js
*
*
* <br />
*
* // main.js
*
- * var Image
Actor = require(" ImageActor
.js");
+ * var Image
View = require(" ImageView
.js");
*
*
- * var image
Actor = new ImageActor( position, ro
tation, image, "my first image actor");
+ * var image
View = new ImageView( position, orien
tation, image, "my first image actor");
*
* #### Exporting as a singleton
*
*
* #### Exporting as a singleton
*
@@
-306,9
+314,7
@@
bool ModuleLoader::ExecuteScriptFromFile( v8::Isolate* isolate,
* @for ModuleLoader
*
*/
* @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 );
{
v8::Isolate* isolate = args.GetIsolate();
v8::HandleScope handleScope( isolate );
@@
-388,6
+394,12
@@
void ModuleLoader::Require(const v8::FunctionCallbackInfo< v8::Value >& args,
args.GetReturnValue().Set( moduleExports );
}
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);
void ModuleLoader::StoreScriptInfo( const std::string& sourceFileName )
{
V8Utils::GetFileDirectory( sourceFileName, mCurrentScriptPath);