App.js
Upload User: aa118c
Upload Date: 2021-05-13
Package Size: 4785k
Code Size: 2k
Development Platform:

HTML/CSS

  1. /*
  2.  * Ext JS Library 2.2.1
  3.  * Copyright(c) 2006-2009, Ext JS, LLC.
  4.  * licensing@extjs.com
  5.  * 
  6.  * http://extjs.com/license
  7.  */
  8. Ext.app.App = function(cfg){
  9.     Ext.apply(this, cfg);
  10.     this.addEvents({
  11.         'ready' : true,
  12.         'beforeunload' : true
  13.     });
  14.     Ext.onReady(this.initApp, this);
  15. };
  16. Ext.extend(Ext.app.App, Ext.util.Observable, {
  17.     isReady: false,
  18.     startMenu: null,
  19.     modules: null,
  20.     getStartConfig : function(){
  21.     },
  22.     initApp : function(){
  23.      this.startConfig = this.startConfig || this.getStartConfig();
  24.         this.desktop = new Ext.Desktop(this);
  25. this.launcher = this.desktop.taskbar.startMenu;
  26. this.modules = this.getModules();
  27.         if(this.modules){
  28.             this.initModules(this.modules);
  29.         }
  30.         this.init();
  31.         Ext.EventManager.on(window, 'beforeunload', this.onUnload, this);
  32. this.fireEvent('ready', this);
  33.         this.isReady = true;
  34.     },
  35.     getModules : Ext.emptyFn,
  36.     init : Ext.emptyFn,
  37.     initModules : function(ms){
  38. for(var i = 0, len = ms.length; i < len; i++){
  39.             var m = ms[i];
  40.             this.launcher.add(m.launcher);
  41.             m.app = this;
  42.         }
  43.     },
  44.     getModule : function(name){
  45.      var ms = this.modules;
  46.      for(var i = 0, len = ms.length; i < len; i++){
  47.      if(ms[i].id == name || ms[i].appType == name){
  48.      return ms[i];
  49. }
  50.         }
  51.         return '';
  52.     },
  53.     onReady : function(fn, scope){
  54.         if(!this.isReady){
  55.             this.on('ready', fn, scope);
  56.         }else{
  57.             fn.call(scope, this);
  58.         }
  59.     },
  60.     getDesktop : function(){
  61.         return this.desktop;
  62.     },
  63.     onUnload : function(e){
  64.         if(this.fireEvent('beforeunload', this) === false){
  65.             e.stopEvent();
  66.         }
  67.     }
  68. });