@@ -28785,6 +28785,33 @@ System.register("npm:postcss@4.1.9", ["npm:postcss@4.1.9/lib/postcss"], true, fu
2878528785 return module.exports;
2878628786});
2878728787
28788+ System.register('build/js/lib/deferred-promise', ['npm:bluebird@2.9.25'], function (_export) {
28789+ var Promise;
28790+
28791+ function deferredPromise() {
28792+ var resolve, reject;
28793+ var promise = new Promise(function () {
28794+ resolve = arguments[0];
28795+ reject = arguments[1];
28796+ });
28797+ return {
28798+ resolve: resolve,
28799+ reject: reject,
28800+ promise: promise
28801+ };
28802+ }
28803+
28804+ return {
28805+ setters: [function (_npmBluebird2925) {
28806+ Promise = _npmBluebird2925['default'];
28807+ }],
28808+ execute: function () {
28809+ 'use strict';
28810+
28811+ _export('default', deferredPromise);
28812+ }
28813+ };
28814+ });
2878828815System.register('build/js/actions/PlaygroundActions', ['build/js/dispatcher/AppDispatcher', 'build/js/constants/PlaygroundConstants'], function (_export) {
2878928816 var AppDispatcher, PlaygroundConstants, TodoActions;
2879028817 return {
@@ -29161,8 +29188,8 @@ System.register('build/js/dispatcher/AppDispatcher', ['npm:flux@2.0.3'], functio
2916129188 }
2916229189 };
2916329190});
29164- System.register('build/js/stores/PlaygroundSettingsStore', ['build/js/dispatcher/AppDispatcher', 'build/js/constants/PlaygroundConstants', 'npm:immutable@3.7.2', 'npm:events@1.0.2', 'npm:object-assign@2.0.0', 'npm:localforage@1.2.2', 'npm:bluebird@2.9.25'], function (_export) {
29165- var AppDispatcher, PlaygroundConstants, Immutable, events, assign, localforage, Promise, EventEmitter, CHANGE_EVENT, playgroundSettings, pluginSettings, PlaygroundSettingsStore;
29191+ System.register('build/js/stores/PlaygroundSettingsStore', ['build/js/dispatcher/AppDispatcher', 'build/js/constants/PlaygroundConstants', 'npm:immutable@3.7.2', 'npm:events@1.0.2', 'npm:object-assign@2.0.0', 'npm:localforage@1.2.2', 'npm:bluebird@2.9.25', 'build/js/lib/deferred-promise' ], function (_export) {
29192+ var AppDispatcher, PlaygroundConstants, Immutable, events, assign, localforage, Promise, deferredPromise, EventEmitter, CHANGE_EVENT, isSettingsInitializedDeferredPromise , playgroundSettings, pluginSettings, PlaygroundSettingsStore;
2916629193
2916729194 function retrieveSettingsFromPersistantStorage() {
2916829195 console.log('Retrieving settings from persistent storage...');
@@ -29199,6 +29226,8 @@ System.register('build/js/stores/PlaygroundSettingsStore', ['build/js/dispatcher
2919929226 localforage = _npmLocalforage122['default'];
2920029227 }, function (_npmBluebird2925) {
2920129228 Promise = _npmBluebird2925['default'];
29229+ }, function (_buildJsLibDeferredPromise) {
29230+ deferredPromise = _buildJsLibDeferredPromise['default'];
2920229231 }],
2920329232 execute: function () {
2920429233 'use strict';
@@ -29212,6 +29241,7 @@ System.register('build/js/stores/PlaygroundSettingsStore', ['build/js/dispatcher
2921229241 });
2921329242
2921429243 CHANGE_EVENT = 'CHANGE_EVENT';
29244+ isSettingsInitializedDeferredPromise = deferredPromise();
2921529245 playgroundSettings = Immutable.Map({
2921629246 shouldLiveReload: true,
2921729247 tabWidth: 'inherit'
@@ -29223,6 +29253,10 @@ System.register('build/js/stores/PlaygroundSettingsStore', ['build/js/dispatcher
2922329253 });
2922429254 PlaygroundSettingsStore = assign({}, EventEmitter.prototype, {
2922529255
29256+ getIsSettingsInitializedPromise: function getIsSettingsInitializedPromise() {
29257+ return isSettingsInitializedDeferredPromise.promise;
29258+ },
29259+
2922629260 getPluginSettings: function getPluginSettings() {
2922729261 return pluginSettings;
2922829262 },
@@ -29251,8 +29285,10 @@ System.register('build/js/stores/PlaygroundSettingsStore', ['build/js/dispatcher
2925129285 case PlaygroundConstants.PLAYGROUND_INIT:
2925229286 retrieveSettingsFromPersistantStorage().then(function () {
2925329287 console.log('Settings Retrieved!');
29288+ isSettingsInitializedDeferredPromise.resolve();
2925429289 PlaygroundSettingsStore.emitChange();
2925529290 })['catch'](function (e) {
29291+ isSettingsInitializedDeferredPromise.reject(e);
2925629292 console.log('Error retrieving playground settings:', e);
2925729293 });
2925829294 break;
@@ -29379,6 +29415,16 @@ System.register('build/js/stores/PlaygroundStore', ['build/js/dispatcher/AppDisp
2937929415 dispatchToken: AppDispatcher.register(function (action) {
2938029416
2938129417 switch (action.actionType) {
29418+ case PlaygroundConstants.PLAYGROUND_INIT:
29419+ AppDispatcher.waitFor([PlaygroundSettingsStore.dispatchToken]);
29420+
29421+ // Once the PlaygroundSettingsStore has all of the data loaded
29422+ // from persistent storage, update the processor
29423+ PlaygroundSettingsStore.getIsSettingsInitializedPromise().then(function () {
29424+ updateProcessor(PlaygroundSettingsStore.getPluginSettings());
29425+ });
29426+ break;
29427+
2938229428 case PlaygroundConstants.PLAYGROUND_KEYBOARD_ACTION:
2938329429 keyboardActionStream.emit('KEYBOARD_ACTION');
2938429430 break;
0 commit comments