📄 object.js
字号:
/*
* Isomorphic SmartClient
* Version 6.5 (2008-04-30)
* Copyright(c) 1998-2007 Isomorphic Software, Inc. All rights reserved.
* "SmartClient" is a trademark of Isomorphic Software, Inc.
*
* licensing@smartclient.com
*
* http://smartclient.com/license
*/
isc.noOp = function () {};isc.emptyObject = {};isc._emptyArray = [];// normal and obfuscatable nameisc.emptyString = isc._emptyString = "";isc.dot = ".";isc.semi = ";";isc.colon = ":";isc.slash = "/";isc.star = "*";isc.auto = "auto";isc.px = "px";isc.nbsp = " ";isc.xnbsp = "&nbsp;"; // XHTMLisc._false = "false";isc._falseUC = "FALSE";isc._underscore = "_";isc._obsPrefix = "_$_";isc._superProtoPrefix = "_$SuperProto_";//> @classMethod isc.logWarn()// Same as +link{method:Log.logWarn}.//// @param message (String) message to log// @param [category] (String) category to log in, defaults to "Log"//// @visibility external//<isc.logWarn = function (message, category) { isc.Log.logWarn(message, category) }//> @classMethod isc.echo()// Same as +link{method:Log.echo}.//// @param value (any) object to echo// @return (string) a short string representation of the object//// @visibility external//<isc.echo = function (value) { return isc.Log.echo(value) }//> @classMethod isc.echoAll()// Same as +link{method:Log.echoAll}.//// @param value (any) object to echo// @return (string) a short string representation of the object//// @visibility external//<isc.echoAll = function (value) { return isc.Log.echoAll(value) }//> @classMethod isc.echoLeaf()// Same as +link{method:Log.echoLeaf}.//// @param value (any) object to echo// @return (string) a short string representation of the object//// @visibility external//<isc.echoLeaf = function (value) { return isc.Log.echoLeaf(value) }isc.echoFull = function (value) { return isc.Log.echoFull(value) }//> @classMethod isc.logEcho()// Logs the echoed object (using +link{classMethod:isc.echo}) as a warning, prefixed with an// optional message.//// @param value (any) object to echo// @param message (String) message to log//// @see Log.logWarn() for logging info// @visibility external//<isc.logEcho = function (value, message) { if (message) message += ": "; isc.Log.logWarn((message || isc._emptyString) + isc.echo(value)) }//> @classMethod isc.logEchoAll()// Logs the echoed object (using +link{classMethod:isc.echoAll}) as a warning, prefixed with an// optional message.//// @param value (any) object to echo// @param message (String) message to log//// @see Log.logWarn() for logging info// @visibility external//<isc.logEchoAll = function (value, message) { if (message) message += ": "; isc.Log.logWarn((message || isc._emptyString) + isc.echoAll(value)) }// OutputAsString / StackWalking / Tracing// ---------------------------------------------------------------------------------------isc._makeFunction = function (args, script) { var code = script || args; return script == null ? new Function(code) : new Function(args, code);};isc.doEval = function (code) { // transform code and eval inline if (isc.Browser.isMoz) return isc._transformCode(code); //return isc._transformCode(code); if (!isc._evalSet) isc._evalSet = []; isc._evalSet[isc._evalSet.length] = code; return null;}// called at module endisc.finalEval = function () { //!OBFUSCATEOK if (isc._evalSet) { if (isc.Browser.isMoz) { for (var i = 0; i < isc._evalSet.length; i++) { eval(isc._evalSet[i]); } } var code = isc._evalSet.join(""); if (isc.Browser.isSafari) code = isc._transformCode(code); // uncomment to use catch/rethrow stacks in IE as well //else if (isc.Browser.isIE) code = isc._transformCode(code); if (isc.Browser.isIE) window.execScript(code, "javascript"); // Safari else eval(code); // Init pipelining: set a timeout to eval so that the module init time takes place // while the next module is being downloaded (except for the last module) // Can't be used for real until /* var evalFunc = function () { if (isc.Browser.isIE) window.execScript(code, "javascript"); // Safari else eval(code); } if (isc.module_DataBinding != 1) { //if (isc.Log) isc.Log.logWarn("delaying eval"); setTimeout(evalFunc, 0) } else { evalFunc(); } */ } isc._evalSet = null;}//isc._eitherMarker = /\/\/\$[01]/;isc._startMarker = "//$0";isc._endMarker = "//$1";isc._totalTransformTime = 0;// code transform time, all modules// - Moz: about 140ms// - NOTE: overall init time rises by about 400ms, the balance is due to slower parsing// because of the added try/catch constructs. This can be demonstrated by doing the// split/join, but just restoring the markers// - Safari: about 300ms// - IE: 266ms// - NOTE: some key advantages of this approach as compared to server-side generation *aside// from* not hosing IE's ability to do full stack traces w/o try/catch:// - allows arbitrary start/end code to be added with only client-side changes// - can be conditional per load// - much smaller code size impact: could ship w/o local vars for production useisc._addCallouts = true;isc._transformCode = function (code) { // set flag indicating stack walking is enabled so that we will also add try..catch to // generated functions isc._stackWalkEnabled = true; var start = isc.timeStamp ? isc.timeStamp() : new Date().getTime(); var startCode = isc._tryBlock, endCode = isc._evalFromCatchBlock; if (isc._addCallouts) startCode = isc._methodEnter + startCode; var chunks = code.split(isc._eitherMarker), finalCode = []; var chunks = code.split(isc._startMarker); code = chunks.join(startCode); chunks = code.split(isc._endMarker); code = chunks.join(endCode); if (isc._addCallouts) { chunks = code.split("//$2"); code = chunks.join(isc._methodExit); } /* // approach of single split and join to cut down on String churn. // Problem is that because of nested functions, markers do not alternate. Would need to // detect which kind of marker is needed for a given slot, by eg checking the next char // over, which might be expensive enough to wipe out any advantage; untested. var pos = 0; for (var i = 0; i < chunks.length; i++) { finalCode[pos++] = chunks[i]; if (i < chunks.length-1) { finalCode[pos++] = i % 2 == 0 ? isc._tryBlock : isc._evalFromCatchBlock; } } finalCode = finalCode.join(""); try { window.eval(finalCode); } catch (e) { //if (!this._alerted) alert(finalCode.substring(0,5000)); //this._alerted = true; document.write("chunks<br><TEXTAREA style='width:760px;height:400px'>" + chunks.join("\n***") + "</" + "TEXTAREA>"); document.write("finalCode<br><TEXTAREA style='width:760px;height:400px'>" + finalCode + "</" + "TEXTAREA>"); throw e; } //return finalCode; */ var end = isc.timeStamp ? isc.timeStamp() : new Date().getTime(); isc._totalTransformTime += (end-start); return code;}isc._evalFromCatchBlock = "}catch(_e){eval(isc._handleError(";isc._handleError = function (varList) { var code = "var _ = {"; if (varList != "") { var varNames = varList.split(","); for (var i = 0; i < varNames.length; i++) { var varName = varNames[i]; code += varName + ":" + varName; if (i < varNames.length-1) code += ","; } } code += "};"; code += "if(isc.Log)isc.Log._reportJSError(_e,arguments,this,_);throw _e;"; return code;}// fillList - utility to concat a number of individual arguments into an array// ---------------------------------------------------------------------------------------isc.fillList = function (array, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z) { if (array == null) array = []; else array.length = 0; var undef; // avoid touching the arguments object if possible if (X === undef && Y === undef && Z === undef) { array[0] = A; array[1] = B; array[2] = C; array[3] = D; array[4] = E; array[5] = F; array[6] = G; array[7] = H; array[8] = I; array[9] = J; array[10] = K; array[11] = L; array[12] = M; array[13] = N; array[14] = O; array[15] = P; array[16] = Q; array[17] = R; array[18] = S; array[19] = T; array[20] = U; array[21] = V; array[22] = W; } else { for (var i = 1; i < arguments.length; i++) { array[i-1] = arguments[i]; } } return array;}//> @classMethod isc.addProperties()//// Add all properties and methods from any number of objects to a destination object, // overwriting properties in the destination object.// <p>// Common uses of <code>addProperties</code> include creating a shallow copy of an object:<pre>//// isc.addProperties({}, someObject);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -