diff options
Diffstat (limited to 'js/io/system/coreioapi.js')
-rwxr-xr-x | js/io/system/coreioapi.js | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index 3fb9374a..b821936f 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js | |||
@@ -55,8 +55,50 @@ exports.CoreIoApi = Montage.create(Component, { | |||
55 | handleReady: { | 55 | handleReady: { |
56 | enumerable: false, | 56 | enumerable: false, |
57 | value: function (e) { | 57 | value: function (e) { |
58 | // | ||
58 | this.chromeFileSystem.removeEventListener('ready', this, false); | 59 | this.chromeFileSystem.removeEventListener('ready', this, false); |
59 | this.chromeNinjaLibrary = this.chromeFileSystem.getLocalLibrary(); | 60 | // |
61 | this.chromeFileSystem.addEventListener('library', this, false); | ||
62 | } | ||
63 | }, | ||
64 | //////////////////////////////////////////////////////////////////// | ||
65 | // | ||
66 | handleLibrary: { | ||
67 | enumerable: false, | ||
68 | value: function (e) { | ||
69 | //Removing events | ||
70 | this.chromeFileSystem.removeEventListener('library', this, false); | ||
71 | // | ||
72 | var xhr = new XMLHttpRequest(), libs, tocopylibs = []; | ||
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 | } | ||
60 | } | 102 | } |
61 | }, | 103 | }, |
62 | //////////////////////////////////////////////////////////////////// | 104 | //////////////////////////////////////////////////////////////////// |