From 516e04ab45ca1dbad9c2847a9a213919d6e812f5 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 7 Feb 2012 14:50:48 -0800 Subject: Adding library synced events Added an event that will be dispatched when Ninja loads and the local chrome Ninja library is fully synced with all required libs. --- js/io/system/coreioapi.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'js/io/system/coreioapi.js') diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index 9836f33f..005eabf2 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js @@ -58,9 +58,9 @@ exports.CoreIoApi = Montage.create(Component, { handleReady: { enumerable: false, value: function (e) { - // + //Removing events this.chromeFileSystem.removeEventListener('ready', this, false); - // + //Listening for library to be copied event (builds list) this.chromeFileSystem.addEventListener('library', this, false); } }, @@ -71,10 +71,24 @@ exports.CoreIoApi = Montage.create(Component, { value: function (e) { //Removing events this.chromeFileSystem.removeEventListener('library', this, false); - // + //Listening for synced library event + this.ninjaLibrary.addEventListener('sync', this, false); + //Sending library to be synced to chrome this.ninjaLibrary.synchronize(e._event.ninjaChromeLibrary, this.chromeFileSystem); + } }, + //////////////////////////////////////////////////////////////////// + // + handleSync: { + enumerable: false, + value: function (e) { + //Removing events + console.log('Ninja Local Library: Ready'); + this.ninjaLibrary.removeEventListener('sync', this, false); + //TODO: Add sync loading screen logic + } + }, //////////////////////////////////////////////////////////////////// // _chromeNinjaLibrary: { -- cgit v1.2.3