diff options
Diffstat (limited to 'js/io/system/coreioapi.js')
-rwxr-xr-x | js/io/system/coreioapi.js | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index 3be6011d..b821936f 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js | |||
@@ -66,14 +66,39 @@ exports.CoreIoApi = Montage.create(Component, { | |||
66 | handleLibrary: { | 66 | handleLibrary: { |
67 | enumerable: false, | 67 | enumerable: false, |
68 | value: function (e) { | 68 | value: function (e) { |
69 | // | 69 | //Removing events |
70 | this.chromeFileSystem.removeEventListener('library', this, false); | 70 | this.chromeFileSystem.removeEventListener('library', this, false); |
71 | // | 71 | // |
72 | if (e._event.ninjaChromeLibrary.length < 1) { | 72 | var xhr = new XMLHttpRequest(), libs, tocopylibs = []; |
73 | console.log('no libraries'); | 73 | //Getting known json list of libraries to copy to chrome |
74 | } else { | 74 | xhr.open("GET", '/ninja-internal/js/io/system/ninjalibrary.json', false); |
75 | console.log('found libraries'); | 75 | xhr.send(); |
76 | } | 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 | } | ||
77 | } | 102 | } |
78 | }, | 103 | }, |
79 | //////////////////////////////////////////////////////////////////// | 104 | //////////////////////////////////////////////////////////////////// |