aboutsummaryrefslogtreecommitdiff
path: root/js/io/system/coreioapi.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/io/system/coreioapi.js')
-rwxr-xr-xjs/io/system/coreioapi.js34
1 files changed, 4 insertions, 30 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index b821936f..9836f33f 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -17,6 +17,7 @@ var Montage = require("montage/core/core").Montage,
17 Popup = require("js/components/popup.reel").Popup, 17 Popup = require("js/components/popup.reel").Popup,
18 CloudPopup = require("js/io/ui/cloudpopup.reel").CloudPopup, 18 CloudPopup = require("js/io/ui/cloudpopup.reel").CloudPopup,
19 ChromeApi = require("js/io/system/chromeapi").ChromeApi; 19 ChromeApi = require("js/io/system/chromeapi").ChromeApi;
20 NinjaLibrary = require("js/io/system/ninjalibrary").NinjaLibrary;
20//////////////////////////////////////////////////////////////////////// 21////////////////////////////////////////////////////////////////////////
21//Exporting as Project I/O 22//Exporting as Project I/O
22exports.CoreIoApi = Montage.create(Component, { 23exports.CoreIoApi = Montage.create(Component, {
@@ -37,6 +38,8 @@ exports.CoreIoApi = Montage.create(Component, {
37 this.ioServiceDetected = false; 38 this.ioServiceDetected = false;
38 } 39 }
39 //////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////
41 //Instance of ninja library
42 this.ninjaLibrary = NinjaLibrary;
40 //Getting reference of chrome file system API 43 //Getting reference of chrome file system API
41 this.chromeFileSystem = ChromeApi; 44 this.chromeFileSystem = ChromeApi;
42 //Sending size in MBs for file system storage 45 //Sending size in MBs for file system storage
@@ -69,36 +72,7 @@ exports.CoreIoApi = Montage.create(Component, {
69 //Removing events 72 //Removing events
70 this.chromeFileSystem.removeEventListener('library', this, false); 73 this.chromeFileSystem.removeEventListener('library', this, false);
71 // 74 //
72 var xhr = new XMLHttpRequest(), libs, tocopylibs = []; 75 this.ninjaLibrary.synchronize(e._event.ninjaChromeLibrary, this.chromeFileSystem);
73 //Getting known json list of libraries to copy to chrome
74 xhr.open("GET", '/ninja-internal/js/io/system/ninjalibrary.json', false);
75 xhr.send();
76 //Checkng for correct reponse
77 if (xhr.readyState === 4) {
78 //Parsing json libraries
79 libs = JSON.parse(xhr.response);
80 //
81 if (e._event.ninjaChromeLibrary.length > 0) {
82 //Compare
83 } else {
84 //No library is present, must copy all
85 for (var i in libs.libraries) {
86 if (libs.libraries[i].singular) {
87 tocopylibs.push({name: String(libs.libraries[i].name+libs.libraries[i].version).toLowerCase(), path: libs.libraries[i].path, singular: true});
88 } else {
89 tocopylibs.push({name: String(libs.libraries[i].name+libs.libraries[i].version).toLowerCase(), path: libs.libraries[i].path, singular: false});
90 }
91 }
92 }
93 //
94 if (tocopylibs.length > 0) {
95 //Copy libraries
96 } else {
97 //No libraries to copy
98 }
99 } else {
100 //Error
101 }
102 } 76 }
103 }, 77 },
104 //////////////////////////////////////////////////////////////////// 78 ////////////////////////////////////////////////////////////////////