⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gwt.js

📁 移动营业厅 礼品派送 短信 倒计时控制 锁定gwt 开发 图片上传等
💻 JS
📖 第 1 页 / 共 2 页
字号:
  }}//////////////////////////////////////////////////////////////////////////////// Globals//var __gwt_retryWaitMillis = 10;var __gwt_isHostPageLoaded = false;var __gwt_metaProps = {};var __gwt_onPropertyError = null;var __gwt_onLoadError = null;var __gwt_moduleControlBlocks = new ModuleControlBlocks();//////////////////////////////////////////////////////////////////////////////// Common ///** * Determines whether or not the page is being loaded in the GWT hosted browser. */function __gwt_isHosted() {  if (window.external && window.external.gwtOnLoad) {    // gwt.hybrid makes the hosted browser pretend not to be    if (document.location.href.indexOf("gwt.hybrid") == -1) {      return true;    }  }  return false;}/** * Tries to get a module control block based on a query string passed in from * the caller. Used by iframes to get references back to their mcbs. * @param queryString the entire query string as returned by location.search, * which notably includes the leading '?' if one is specified * @return the relevant module control block, or <code>null</code> if it cannot  * be derived based on <code>queryString</code> */function __gwt_tryGetModuleControlBlock(queryString) {  if (queryString.length > 0) {    // The pattern is ?[h&]<index>[&<unique>]    var queryString = queryString.substring(1);    if (queryString.indexOf("h&") == 0) {      // Ignore the hosted mode flag here; only GWTShellServlet cares about it.      queryString = queryString.substring(2);    }    var pos = queryString.indexOf("&");    if (pos >= 0) {      queryString = queryString.substring(0, pos);    }    var mcbIndex = parseInt(queryString);    if (!isNaN(mcbIndex)) {      var mcb = __gwt_moduleControlBlocks.get(mcbIndex);      return mcb;    }    // Ignore the unique number that remains on the query string.  }  return null;}/** * Parses meta tags from the host html. *  * <meta name="gwt:module" content="_module-name_"> *    causes the specified module to be loaded * * <meta name="gwt:property" content="_name_=_value_"> *    statically defines a deferred binding client property * * <meta name="gwt:onPropertyErrorFn" content="_fnName_"> *    specifies the name of a function to call if a client property is set to  *    an invalid value (meaning that no matching compilation will be found) *  * <meta name="gwt:onLoadErrorFn" content="_fnName_"> *    specifies the name of a function to call if an exception happens during  *    bootstrapping or if a module throws an exception out of onModuleLoad();  *    the function should take a message parameter */function __gwt_processMetas() {  var metas = document.getElementsByTagName("meta");  for (var i = 0, n = metas.length; i < n; ++i) {    var meta = metas[i];    var name = meta.getAttribute("name");    if (name) {      if (name == "gwt:module") {        var moduleName = meta.getAttribute("content");        if (moduleName) {          __gwt_moduleControlBlocks.add(meta, moduleName);        }      } else if (name == "gwt:property") {        var content = meta.getAttribute("content");        if (content) {          var name = content, value = "";          var eq = content.indexOf("=");          if (eq != -1) {            name = content.substring(0, eq);            value = content.substring(eq+1);          }          __gwt_metaProps[name] = value;        }      } else if (name == "gwt:onPropertyErrorFn") {        var content = meta.getAttribute("content");        if (content) {          try {            __gwt_onPropertyError = eval(content);          } catch (e) {            window.alert("Bad handler \"" + content +               "\" for \"gwt:onPropertyErrorFn\"");          }        }      } else if (name == "gwt:onLoadErrorFn") {        var content = meta.getAttribute("content");        if (content) {          try {            __gwt_onLoadError = eval(content);          } catch (e) {            window.alert("Bad handler \"" + content +               "\" for \"gwt:onLoadErrorFn\"");          }        }      }    }  }}/** * Determines the value of a deferred binding client property specified  * statically in host html. */function __gwt_getMetaProperty(name) {  var value = __gwt_metaProps[name];  if (value) {    return value;  } else {    return null;  }}/** * Determines whether or not a particular property value is allowed. * @param wnd the caller's window object (not $wnd!) * @param propName the name of the property being checked * @param propValue the property value being tested */function __gwt_isKnownPropertyValue(wnd, propName, propValue) {  return propValue in wnd["values$" + propName];}/** * Called by the selection script when a property has a bad value or is missing. * 'allowedValues' is an array of strings. Can be hooked in the host page using  * gwt:onPropertyErrorFn. */function __gwt_onBadProperty(moduleName, propName, allowedValues, badValue) {  if (__gwt_onPropertyError) {    __gwt_onPropertyError(moduleName, propName, allowedValues, badValue);    return;  } else {    var msg = "While attempting to load module \"" + moduleName + "\", ";    if (badValue != null) {       msg += "property \"" + propName + "\" was set to the unexpected value \""         + badValue + "\"";    } else {       msg += "property \"" + propName + "\" was not specified";    }        msg += "\n\nAllowed values: " + allowedValues;       window.alert(msg);  }}/** * Called directly from compiled code. */function __gwt_initHandlers(resize, beforeunload, unload) {   var oldOnResize = window.onresize;   window.onresize = function() {      resize();      if (oldOnResize)         oldOnResize();   };   var oldOnBeforeUnload = window.onbeforeunload;   window.onbeforeunload = function() {      var ret = beforeunload();      var oldRet;      if (oldOnBeforeUnload)        oldRet = oldOnBeforeUnload();      if (ret !== null)        return ret;      return oldRet;   };   var oldOnUnload = window.onunload;   window.onunload = function() {      unload();      if (oldOnUnload)         oldOnUnload();   };}//////////////////////////////////////////////////////////////////////////////// Hosted Mode//function __gwt_onUnloadHostedMode() {    window.external.gwtOnLoad(null, null);    if (__gwt_onUnloadHostedMode.oldUnloadHandler) {        __gwt_onUnloadHostedMode.oldUnloadHandler();    }}//////////////////////////////////////////////////////////////////////////////// Bootstrap///** * Waits until all startup preconditions are satisfied, then launches the  * user-defined startup code for each module. */function __gwt_latchAndLaunch() {  var ready = true;    // Are there any compilations still pending?  if (ready && !__gwt_moduleControlBlocks.isReady()) {    // Yes, we're still waiting on one or more compilations.    ready = false;  }  // Has the host html onload event fired?  if (ready && !__gwt_isHostPageLoaded) {    // No, the host html page hasn't fully loaded.    ready = false;  }    // Are we ready to run user code?  if (ready) {    // Yes: run entry points.    __gwt_moduleControlBlocks.run();  } else {    // No: try again soon.    window.setTimeout(__gwt_latchAndLaunch, __gwt_retryWaitMillis);  }}/** * Starts the module-loading sequence after meta tags have been processed and * the body element exists. */function __gwt_loadModules() {  // Make sure the body element exists before starting.  if (!document.body) {    // Try again soon.    window.setTimeout(__gwt_loadModules, __gwt_retryWaitMillis);    return;  }  // Inject a frame for each module.  __gwt_moduleControlBlocks.injectFrames();  // Try to launch module entry points once everything is ready.  __gwt_latchAndLaunch();}/** * The very first thing to run, and it runs exactly once unconditionally. */function __gwt_bootstrap() {  // Hook onunload for hosted mode.  if (__gwt_isHosted()) {    __gwt_onUnloadHostedMode.oldUnloadHandler = window.onunload;    window.onunload = __gwt_onUnloadHostedMode;  }  // Hook the current window onload handler.  var oldHandler = window.onload;  window.onload = function() {    __gwt_isHostPageLoaded = true;    if (oldHandler) {      oldHandler();    }  };  // Parse meta tags from host html.  __gwt_processMetas();  // Load any modules.  __gwt_loadModules();}// Go.__gwt_bootstrap();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -