Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
|
|
@ -0,0 +1,8 @@
|
|||
;'use strict';(function(exports){var StateManager=function(app){this.app=app;this._started=false;this._isActive=undefined;this._layoutName=undefined;};StateManager.prototype.start=function(){this.app.console.log('StateManager.start()');if(this._started){throw new Error('StateManager: Should not be start()\'ed twice.');}
|
||||
this._started=true;this._isActive=false;this._queue=new AbortablePromiseQueue();this._queue.start();window.addEventListener('hashchange',this);window.addEventListener('visibilitychange',this);navigator.mozInputMethod.addEventListener('inputcontextchange',this);this.app.setInputContext(navigator.mozInputMethod.inputcontext);this._layoutName=window.location.hash.substr(1);var active=(!document.hidden&&!!this.app.inputContext);if(!active){this._queue.run([this._preloadLayout.bind(this),this._preloadInputMethod.bind(this),this.app.l10nLoader.load.bind(this.app.l10nLoader)]);}
|
||||
this._updateActiveState(active);};StateManager.prototype.stop=function(){this.app.console.log('StateManager.stop()');if(!this._started){throw new Error('StateManager: Was not start()\'ed but stop() is called.');}
|
||||
this._started=false;this._queue.stop();this._queue=null;window.removeEventListener('hashchange',this);window.removeEventListener('visibilitychange',this);navigator.mozInputMethod.removeEventListener('inputcontextchange',this);this._isActive=undefined;this._layoutName=undefined;};StateManager.prototype.handleEvent=function(evt){var active=(!document.hidden&&!!navigator.mozInputMethod.inputcontext);this.app.console.info('StateManager.handleEvent()',evt,active);switch(evt.type){case'hashchange':this._layoutName=window.location.hash.substr(1);if(!active){this._queue.run([this._preloadLayout.bind(this),this._preloadInputMethod.bind(this)]);}
|
||||
break;case'visibilitychange':break;case'inputcontextchange':this.app.setInputContext(navigator.mozInputMethod.inputcontext);break;}
|
||||
this._updateActiveState(active);};StateManager.prototype._updateActiveState=function(active){this.app.console.log('StateManager._updateActiveState()',active);if(active){this.app.console.time('activate');this._queue.run([function(){this.app.candidatePanelManager.hideFullPanel();this.app.candidatePanelManager.updateCandidates([]);this.app.inputMethodManager.deactivateIMEngine();this.app.feedbackManager.activate();}.bind(this),this.app.layoutManager.switchCurrentLayout.bind(this.app.layoutManager,this._layoutName),this._activateIMEngineForCurrentPage.bind(this),this.app.layoutRenderingManager.updateLayoutRendering.bind(this.app.layoutRenderingManager),this.app.l10nLoader.load.bind(this.app.l10nLoader)]);}else{if(active===this._isActive){return;}
|
||||
this._queue.run([function(){this.app.candidatePanelManager.hideFullPanel();this.app.candidatePanelManager.updateCandidates([]);this.app.targetHandlersManager.activeTargetsManager.clearAllTargets();this.app.feedbackManager.deactivate();}.bind(this),this.app.inputMethodManager.deactivateIMEngine.bind(this.app.inputMethodManager)]);}
|
||||
this._isActive=active;};StateManager.prototype._preloadLayout=function(){this.app.console.log('StateManager._preloadLayout()');var layoutLoader=this.app.layoutManager.loader;return layoutLoader.getLayoutAsync(this._layoutName);};StateManager.prototype._preloadInputMethod=function(layout){this.app.console.log('StateManager._preloadInputMethod()');var imEngineName=layout.imEngine;var imEngineLoader=this.app.inputMethodManager.loader;if(imEngineName){var p=imEngineLoader.getInputMethodAsync(imEngineName);return p;}};StateManager.prototype._activateIMEngineForCurrentPage=function(){this.app.console.log('StateManager._activateIMEngineForCurrentPage()');var page=this.app.layoutManager.currentPage;var imEngineName=page.imEngine||'default';this.app.upperCaseStateManager.reset();this.app.candidatePanelManager.reset();var p=this.app.inputMethodManager.activateIMEngine(imEngineName);return p;};exports.StateManager=StateManager;})(window);
|
||||
Loading…
Reference in a new issue