UNPKG

jsx

Version:

a faster, safer, easier JavaScript

142 lines (126 loc) 3.16 kB
/** * extends the class */ function $__jsx_extend(derivations, base) { var ctor = function () {}; ctor.prototype = base.prototype; var proto = new ctor(); for (var i in derivations) { derivations[i].prototype = proto; } } /** * copies the implementations from source interface to target */ function $__jsx_merge_interface(target, source) { for (var k in source.prototype) if (source.prototype.hasOwnProperty(k)) target.prototype[k] = source.prototype[k]; } /** * defers the initialization of the property */ function $__jsx_lazy_init(obj, prop, func) { function reset(obj, prop, value) { delete obj[prop]; obj[prop] = value; return value; } Object.defineProperty(obj, prop, { get: function () { return reset(obj, prop, func()); }, set: function (v) { reset(obj, prop, v); }, enumerable: true, configurable: true }); } var $__jsx_imul = Math.imul; if (typeof $__jsx_imul === "undefined") { $__jsx_imul = function (a, b) { var ah = (a >>> 16) & 0xffff; var al = a & 0xffff; var bh = (b >>> 16) & 0xffff; var bl = b & 0xffff; return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0); }; } /** * fused int-ops with side-effects */ function $__jsx_ipadd(o, p, r) { return o[p] = (o[p] + r) | 0; } function $__jsx_ipsub(o, p, r) { return o[p] = (o[p] - r) | 0; } function $__jsx_ipmul(o, p, r) { return o[p] = $__jsx_imul(o[p], r); } function $__jsx_ipdiv(o, p, r) { return o[p] = (o[p] / r) | 0; } function $__jsx_ipmod(o, p, r) { return o[p] = (o[p] % r) | 0; } function $__jsx_ippostinc(o, p) { var v = o[p]; o[p] = (v + 1) | 0; return v; } function $__jsx_ippostdec(o, p) { var v = o[p]; o[p] = (v - 1) | 0; return v; } /** * non-inlined version of Array#each */ function $__jsx_forEach(o, f) { var l = o.length; for (var i = 0; i < l; ++i) f(o[i]); } /* * global functions, renamed to avoid conflict with local variable names */ var $__jsx_parseInt = parseInt; var $__jsx_parseFloat = parseFloat; function $__jsx_isNaN(n) { return n !== n; } var $__jsx_isFinite = isFinite; var $__jsx_encodeURIComponent = encodeURIComponent; var $__jsx_decodeURIComponent = decodeURIComponent; var $__jsx_encodeURI = encodeURI; var $__jsx_decodeURI = decodeURI; var $__jsx_ObjectToString = Object.prototype.toString; var $__jsx_ObjectHasOwnProperty = Object.prototype.hasOwnProperty; /* * profiler object, initialized afterwards */ function $__jsx_profiler() { } /* * public interface to JSX code */ JSX.require = function (path) { var m = $__jsx_classMap[path]; return m !== undefined ? m : null; }; JSX.profilerIsRunning = function () { return $__jsx_profiler.getResults != null; }; JSX.getProfileResults = function () { return ($__jsx_profiler.getResults || function () { return {}; })(); }; JSX.postProfileResults = function (url, cb) { if ($__jsx_profiler.postResults == null) throw new Error("profiler has not been turned on"); return $__jsx_profiler.postResults(url, cb); }; JSX.resetProfileResults = function () { if ($__jsx_profiler.resetResults == null) throw new Error("profiler has not been turned on"); return $__jsx_profiler.resetResults(); };