Add 'jsnative' module
authorWonYoung Choi <wy80.choi@samsung.com>
Tue, 1 Dec 2015 09:59:12 +0000 (18:59 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Tue, 1 Dec 2015 09:59:12 +0000 (18:59 +0900)
JSNative application should require this module first. eg:
require('jsnative');
This module initailizes necessary tasks for JSNative applications.

Change-Id: I0840b5c35f8315e7584ebfd1ab27e1c1ee989605

CMakeLists.txt
jsn-cli/tizen-app-template/pkgid.appid
jsnative/CMakeLists.txt [new file with mode: 0644]
jsnative/main.js [new file with mode: 0644]
jsnative/package.json [new file with mode: 0644]

index 0336ff6..a1beb6c 100644 (file)
@@ -25,6 +25,7 @@ ADD_DEFINITIONS("-std=c++0x")           # accept C++11x standard
 
 SET(GLOBAL_NODE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/lib/node)
 
+ADD_SUBDIRECTORY(jsnative)
 ADD_SUBDIRECTORY(appfw)
 ADD_SUBDIRECTORY(gcontext)
 ADD_SUBDIRECTORY(node-xwalk)
index 2ed49da..4a2596b 100755 (executable)
@@ -1,2 +1,7 @@
 #!/usr/bin/env node
+
+// Initialize JSNative
+require('jsnative');
+
+// Load application's main script
 require('../res/{appid}');
diff --git a/jsnative/CMakeLists.txt b/jsnative/CMakeLists.txt
new file mode 100644 (file)
index 0000000..715ca1f
--- /dev/null
@@ -0,0 +1,13 @@
+SET(TARGET_JSNATIVE "jsnative")
+SET(TARGET_JSNATIVE_SRC ${PROJECT_SOURCE_DIR}/${TARGET_JSNATIVE})
+
+# Copy Project
+INSTALL(FILES
+    ${TARGET_JSNATIVE_SRC}/package.json
+    DESTINATION ${GLOBAL_NODE_MODULE_PATH}/${TARGET_JSNATIVE}
+)
+
+INSTALL(FILES
+    ${TARGET_JSNATIVE_SRC}/main.js
+    DESTINATION ${GLOBAL_NODE_MODULE_PATH}/${TARGET_JSNATIVE}
+)
diff --git a/jsnative/main.js b/jsnative/main.js
new file mode 100644 (file)
index 0000000..6c85724
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+'use strict';
+
+var JSNative = function() {
+};
+
+JSNative._Initialize = function() {
+  require('node-xwalk').install();
+};
+
+JSNative._Initialize();
+
+module.exports = new JSNative();
diff --git a/jsnative/package.json b/jsnative/package.json
new file mode 100644 (file)
index 0000000..94d22db
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "jsnative",
+  "version": "0.0.1",
+  "description": "JSNative common module",
+  "main": "main.js",
+  "author": {
+    "name": "Wonyoung Choi",
+    "email": "wy80.choi@samsung.com"
+  }
+}