├── AJC-bin ├── as-js-wasm │ ├── AjcEmscConsole.js │ ├── AjcRuntimeWeb.js │ ├── AjcRuntimeWeb.wasm │ ├── Namespace.js │ ├── QName.js │ ├── Test_BunnyMark.js │ ├── Test_BunnyMark.js.map │ ├── XML.js │ ├── XMLList.js │ ├── assets │ │ └── skin.png │ ├── bunnyMark │ │ ├── BackGround.js │ │ ├── BackGround.js.map │ │ ├── Bunny.js │ │ ├── Bunny.js.map │ │ ├── BunnyTileTest.js │ │ └── BunnyTileTest.js.map │ ├── index.html │ ├── library │ │ └── closure │ │ │ └── goog │ │ │ ├── array │ │ │ └── array.js │ │ │ ├── asserts │ │ │ └── asserts.js │ │ │ ├── base.js │ │ │ ├── bootstrap │ │ │ └── nodejs.js │ │ │ ├── debug │ │ │ ├── entrypointregistry.js │ │ │ └── error.js │ │ │ ├── deps.js │ │ │ ├── disposable │ │ │ ├── disposable.js │ │ │ └── idisposable.js │ │ │ ├── dom │ │ │ └── nodetype.js │ │ │ ├── events │ │ │ ├── browserevent.js │ │ │ ├── browserfeature.js │ │ │ ├── event.js │ │ │ ├── eventid.js │ │ │ ├── events.js │ │ │ ├── eventtarget.js │ │ │ ├── eventtype.js │ │ │ ├── listenable.js │ │ │ ├── listener.js │ │ │ └── listenermap.js │ │ │ ├── labs │ │ │ └── useragent │ │ │ │ ├── browser.js │ │ │ │ ├── engine.js │ │ │ │ ├── platform.js │ │ │ │ └── util.js │ │ │ ├── object │ │ │ └── object.js │ │ │ ├── reflect │ │ │ └── reflect.js │ │ │ ├── string │ │ │ └── string.js │ │ │ └── useragent │ │ │ └── useragent.js │ └── org │ │ └── apache │ │ └── flex │ │ └── utils │ │ └── Language.js ├── cpp-wasm │ ├── AjcEmscConsole.js │ ├── AjcRuntimeWeb.js │ ├── AjcRuntimeWeb.wasm │ ├── Test_BunnyMark_Native.js │ ├── Test_BunnyMark_Native.js.map │ ├── assets │ │ └── skin.png │ ├── index.html │ └── library │ │ └── closure │ │ └── goog │ │ ├── array │ │ └── array.js │ │ ├── asserts │ │ └── asserts.js │ │ ├── base.js │ │ ├── bootstrap │ │ └── nodejs.js │ │ ├── debug │ │ ├── entrypointregistry.js │ │ └── error.js │ │ ├── deps.js │ │ ├── disposable │ │ ├── disposable.js │ │ └── idisposable.js │ │ ├── dom │ │ └── nodetype.js │ │ ├── events │ │ ├── browserevent.js │ │ ├── browserfeature.js │ │ ├── event.js │ │ ├── eventid.js │ │ ├── events.js │ │ ├── eventtarget.js │ │ ├── eventtype.js │ │ ├── listenable.js │ │ ├── listener.js │ │ └── listenermap.js │ │ ├── labs │ │ └── useragent │ │ │ ├── browser.js │ │ │ ├── engine.js │ │ │ ├── platform.js │ │ │ └── util.js │ │ ├── object │ │ └── object.js │ │ ├── reflect │ │ └── reflect.js │ │ ├── string │ │ └── string.js │ │ └── useragent │ │ └── useragent.js └── win-vc140 │ ├── Test_BunnyMark.exe │ ├── assets │ └── skin.png │ └── start-bunnyMark.bat ├── AJC-code └── as3 │ ├── ajc-asjs-sdk.zip │ ├── build.xml │ ├── config │ ├── as3-mxmlc-config.xml │ ├── js-mxmlc-config.xml │ └── test-config.xml │ ├── files │ ├── AjcRuntimeWeb.js │ ├── AjcRuntimeWeb.wasm │ └── assets │ │ └── skin.png │ ├── libs │ └── ajcFlash.swc │ └── src │ ├── Test_BunnyMark.as │ └── bunnyMark │ ├── BackGround.as │ ├── Bunny.as │ └── BunnyTileTest.as ├── LICENSE ├── README.md └── images ├── code-style-as3.png ├── code-style-cpp.png └── flashdevelop-debug-js.gif /AJC-bin/as-js-wasm/AjcEmscConsole.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @constructor 4 | */ 5 | AjcEmscConsole = function() { 6 | var /** @type {*} */ _script = document.createElement('script'); 7 | _script.onload = this.initWasm.bind(this); 8 | _script.src = ajcGlobal.emscModuleFileName + ".js"; 9 | _script.defer = false; 10 | _script.async = false; 11 | document.head.appendChild(_script); 12 | }; 13 | 14 | /** 15 | * @private 16 | * @type {XMLHttpRequest} 17 | */ 18 | AjcEmscConsole.prototype.loader; 19 | 20 | 21 | /** 22 | * @private 23 | * @type {*} 24 | */ 25 | AjcEmscConsole.prototype.loadedWasmBytes; 26 | 27 | 28 | 29 | /** 30 | * @private 31 | */ 32 | AjcEmscConsole.prototype.initWasm = function() { 33 | this.loader = new XMLHttpRequest(); 34 | this.loader.open('GET', ajcGlobal.emscModuleFileName + ".wasm", true); 35 | this.loader.responseType = 'arraybuffer'; 36 | this.loader.onload = this.loadCompelteEvent.bind(this); 37 | this.loader.send(); 38 | }; 39 | 40 | 41 | /** 42 | * @private 43 | * @param {Event=} e 44 | */ 45 | AjcEmscConsole.prototype.loadCompelteEvent = function(e) { 46 | console.log("wasm loaded"); 47 | this.loadedWasmBytes = this.loader.response; 48 | 49 | var ajcEmscConfig ={}; 50 | ajcEmscConfig.noInitialRun = true; 51 | ajcEmscConfig.onRuntimeInitialized = this.onRuntimeInitialized.bind(this); 52 | ajcEmscConfig.instantiateWasm = this.wasmInstantiateCallBack.bind(this); 53 | 54 | if(ajcGlobal.hasOwnProperty("emscModuleConfig")) 55 | { 56 | Object.keys(ajcGlobal.emscModuleConfig).forEach 57 | ( 58 | function(key) 59 | { 60 | ajcEmscConfig[key] = ajcGlobal.emscModuleConfig[key]; 61 | } 62 | ) 63 | } 64 | 65 | ajcGlobal.stageInitWidth = ajcGlobal.stageInitWidth || 800; 66 | ajcGlobal.stageInitHeight = ajcGlobal.stageInitHeight || 600; 67 | 68 | var _rootHtmlElement = document.createElement('div'); 69 | _rootHtmlElement.style.left = "0px"; 70 | _rootHtmlElement.style.top = "0px"; 71 | _rootHtmlElement.style.position = ajcGlobal.useStageMinSize ? "absolute" : "fixed"; 72 | _rootHtmlElement.style.width = ajcGlobal.stageInitWidth.toString() + "px"; 73 | _rootHtmlElement.style.height = ajcGlobal.stageInitHeight.toString() + "px"; 74 | ajcGlobal.rootHtmlElementID = _rootHtmlElement.id = 'rootHtmlElement'; 75 | document.body.appendChild(_rootHtmlElement); 76 | 77 | 78 | if(!ajcEmscConfig.hasOwnProperty('canvas')) 79 | { 80 | var canvas = document.createElement('canvas'); 81 | canvas.style.position = "fixed"; 82 | canvas.style.left = "0px"; 83 | canvas.style.top = "0px"; 84 | canvas.id= "canvas"; 85 | _rootHtmlElement.appendChild(canvas); 86 | 87 | ajcEmscConfig.canvas = canvas; 88 | } 89 | 90 | window[ajcGlobal.emscOutputModuleName] = new window[ajcGlobal.emscSrcEmscModuleName](ajcEmscConfig); 91 | }; 92 | 93 | /** 94 | * @private 95 | * @param {*} info 96 | * @param {Function} receiveInstance 97 | * @return {*} 98 | */ 99 | AjcEmscConsole.prototype.wasmInstantiateCallBack = function(info, receiveInstance) { 100 | console.log("wasm-Instantiate-CallBack"); 101 | WebAssembly.instantiate(this.loadedWasmBytes, info).then( 102 | function(output) { 103 | console.log("receiveInstance"); 104 | receiveInstance(output["instance"]); 105 | }); 106 | return {}; 107 | }; 108 | 109 | 110 | /** 111 | * @private 112 | */ 113 | AjcEmscConsole.prototype.onRuntimeInitialized = function() 114 | { 115 | 116 | var moduleObject = window[ajcGlobal.emscOutputModuleName]; 117 | 118 | Object.keys(moduleObject).forEach 119 | ( 120 | function(key) 121 | { 122 | if(key.includes("$")) 123 | { 124 | console.log("exported packged classes: "+key); 125 | 126 | var packageArray = key.split('$'); 127 | var len = packageArray.length -1; 128 | var parentPackge = moduleObject; 129 | for(var i = 0; i < len; i++) 130 | { 131 | if(!parentPackge.hasOwnProperty(packageArray[i])) 132 | parentPackge[packageArray[i]] = {}; 133 | 134 | parentPackge = parentPackge[packageArray[i]]; 135 | 136 | } 137 | parentPackge[packageArray[len]] = moduleObject[key]; 138 | delete moduleObject[key]; 139 | } 140 | } 141 | ) 142 | 143 | moduleObject["_STAGE_INSTANCE_"] = new moduleObject.display.Stage(); 144 | moduleObject["_STAGE_INSTANCE_"].addEventListener("init", this.onStageInit.bind(this)); 145 | 146 | var arrayArgs = []; 147 | arrayArgs.push("-windowWidth",ajcGlobal.stageInitWidth.toString()); 148 | arrayArgs.push("-windowHeight",ajcGlobal.stageInitHeight.toString()); 149 | arrayArgs.push("-windowAutoSize",ajcGlobal.stageAutoSize? "1": "0"); 150 | if(ajcGlobal.emscModuleAdditionalMainArgs) 151 | { 152 | var additionalArgsArray = ajcGlobal.emscModuleAdditionalMainArgs.split(" "); 153 | 154 | Array.prototype.push.apply(arrayArgs,additionalArgsArray); 155 | } 156 | window[ajcGlobal.emscOutputModuleName].callMain(arrayArgs); 157 | }; 158 | 159 | AjcEmscConsole.prototype.onStageInit = function(e) 160 | { 161 | console.log("onStageInit"); 162 | 163 | var moduleObject = window[ajcGlobal.emscOutputModuleName]; 164 | 165 | moduleObject["_STAGE_INSTANCE_"].removeEventListener("init", this.onStageInit.bind(this)); 166 | 167 | 168 | if(ajcGlobal.buildType == 'intermediate') 169 | { 170 | goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = true; 171 | goog.require(ajcGlobal.appRootName); 172 | } 173 | else 174 | { 175 | moduleObject["_STAGE_INSTANCE_"].addChild(new window[ajcGlobal.appRootName]()); 176 | } 177 | 178 | var runDependencyWatcher = setInterval(function() 179 | { 180 | if(window[ajcGlobal.appRootName] !== undefined) 181 | { 182 | clearInterval(runDependencyWatcher); 183 | moduleObject["_STAGE_INSTANCE_"].addChild(new window[ajcGlobal.appRootName]()); 184 | return; 185 | } 186 | }, 100); 187 | 188 | } -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/AjcRuntimeWeb.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/AJC-bin/as-js-wasm/AjcRuntimeWeb.wasm -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/Namespace.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated by Apache Flex Cross-Compiler from Namespace.as 3 | * Namespace 4 | * 5 | * @fileoverview 6 | * 7 | * @suppress {checkTypes|accessControls} 8 | */ 9 | 10 | goog.provide('Namespace'); 11 | goog.require('XML'); 12 | goog.require('org.apache.flex.utils.Language'); 13 | 14 | 15 | 16 | /** 17 | * @constructor 18 | * @param {Object=} prefixOrUri 19 | * @param {Object=} uriValue 20 | */ 21 | Namespace = function(prefixOrUri, uriValue) { 22 | prefixOrUri = typeof prefixOrUri !== 'undefined' ? prefixOrUri : null; 23 | uriValue = typeof uriValue !== 'undefined' ? uriValue : null; 24 | if (!uriValue && prefixOrUri) { 25 | var /** @type {Object} */ uriVal = uriValue ? uriValue : prefixOrUri; 26 | if (org.apache.flex.utils.Language.is(uriVal, Namespace)) { 27 | this._prefix = org.apache.flex.utils.Language.as(uriVal, Namespace).prefix; 28 | this._uri = org.apache.flex.utils.Language.as(uriVal, Namespace).uri; 29 | } else if (this.isQName(uriVal)) { 30 | this._uri = org.apache.flex.utils.Language.string(uriVal.uri ? uriVal.uri : this._uri); 31 | } else { 32 | this._uri = uriVal.toString(); 33 | if (this._uri == "") 34 | this._prefix = ""; 35 | } 36 | } else if (uriValue) { 37 | if (this.isQName(uriValue)) { 38 | if (uriValue.uri) 39 | this._uri = org.apache.flex.utils.Language.string(uriValue.uri); 40 | } else { 41 | this._uri = uriValue.toString(); 42 | } 43 | if (!this._uri) { 44 | if (!prefixOrUri) 45 | this._prefix = ""; 46 | else 47 | throw new TypeError("invalid prefix"); 48 | } 49 | else 50 | this._prefix = prefixOrUri.toString(); 51 | } 52 | }; 53 | 54 | 55 | /** 56 | * @private 57 | * @param {Object} val 58 | * @return {boolean} 59 | */ 60 | Namespace.prototype.isQName = function(val) { 61 | if (val == null) 62 | return false; 63 | if (val.hasOwnProperty("uri") && val.hasOwnProperty("localName") && val.hasOwnProperty("prefix")) 64 | return true; 65 | return false; 66 | }; 67 | 68 | 69 | /** 70 | * @private 71 | * @type {string} 72 | */ 73 | Namespace.prototype._uri = ""; 74 | 75 | 76 | /** 77 | * @private 78 | * @type {string} 79 | */ 80 | Namespace.prototype._prefix = null; 81 | 82 | 83 | /** 84 | * @export 85 | * @return {string} 86 | */ 87 | Namespace.prototype.toString = function() { 88 | return this.uri; 89 | }; 90 | 91 | 92 | /** 93 | * @export 94 | * @override 95 | */ 96 | Namespace.prototype.valueOf = function() { 97 | return this; 98 | }; 99 | 100 | 101 | Namespace.prototype.get__uri = function() { 102 | return this._uri; 103 | }; 104 | 105 | 106 | Namespace.prototype.set__uri = function(value) { 107 | this._uri = value; 108 | }; 109 | 110 | 111 | Namespace.prototype.get__prefix = function() { 112 | return this._prefix; 113 | }; 114 | 115 | 116 | Namespace.prototype.set__prefix = function(value) { 117 | this._prefix = value; 118 | }; 119 | 120 | 121 | Object.defineProperties(Namespace.prototype, /** @lends {Namespace.prototype} */ { 122 | /** @export */ 123 | uri: { 124 | get: Namespace.prototype.get__uri, 125 | set: Namespace.prototype.set__uri}, 126 | /** @export */ 127 | prefix: { 128 | get: Namespace.prototype.get__prefix, 129 | set: Namespace.prototype.set__prefix}} 130 | ); 131 | 132 | 133 | /** 134 | * Metadata 135 | * 136 | * @type {Object.>} 137 | */ 138 | Namespace.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Namespace', qName: 'Namespace', kind: 'class' }] }; 139 | 140 | 141 | /** 142 | * Prevent renaming of class. Needed for reflection. 143 | */ 144 | goog.exportSymbol('Namespace', Namespace); 145 | 146 | 147 | 148 | /** 149 | * Reflection 150 | * 151 | * @return {Object.} 152 | */ 153 | Namespace.prototype.FLEXJS_REFLECTION_INFO = function () { 154 | return { 155 | variables: function () {return {};}, 156 | accessors: function () { 157 | return { 158 | 'uri': { type: 'String', access: 'readwrite', declaredBy: 'Namespace'}, 159 | 'prefix': { type: 'String', access: 'readwrite', declaredBy: 'Namespace'} 160 | }; 161 | }, 162 | methods: function () { 163 | return { 164 | 'Namespace': { type: '', declaredBy: 'Namespace', parameters: function () { return [ { index: 1, type: 'Object', optional: true },{ index: 2, type: 'Object', optional: true } ]; }}, 165 | 'toString': { type: 'String', declaredBy: 'Namespace'}, 166 | 'valueOf': { type: '*', declaredBy: 'Namespace'} 167 | }; 168 | } 169 | }; 170 | }; 171 | 172 | //# sourceMappingURL=./Namespace.js.map -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/QName.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated by Apache Flex Cross-Compiler from QName.as 3 | * QName 4 | * 5 | * @fileoverview 6 | * 7 | * @suppress {checkTypes|accessControls} 8 | */ 9 | 10 | goog.provide('QName'); 11 | 12 | goog.require('Namespace'); 13 | goog.require('org.apache.flex.utils.Language'); 14 | goog.require('XML'); 15 | 16 | 17 | 18 | /** 19 | * @constructor 20 | * @param {*=} qNameOrUri 21 | * @param {*=} localNameVal 22 | */ 23 | QName = function(qNameOrUri, localNameVal) { 24 | qNameOrUri = typeof qNameOrUri !== 'undefined' ? qNameOrUri : null; 25 | localNameVal = typeof localNameVal !== 'undefined' ? localNameVal : null; 26 | if (org.apache.flex.utils.Language.is(qNameOrUri, QName)) { 27 | this._uri = org.apache.flex.utils.Language.string(qNameOrUri.uri); 28 | this._localName = org.apache.flex.utils.Language.string(qNameOrUri.localName); 29 | this._prefix = org.apache.flex.utils.Language.string(qNameOrUri.prefix); 30 | } else if (org.apache.flex.utils.Language.is(qNameOrUri, Namespace)) { 31 | this._uri = org.apache.flex.utils.Language.as(qNameOrUri, Namespace).uri; 32 | this._prefix = org.apache.flex.utils.Language.as(qNameOrUri, Namespace).prefix; 33 | if (localNameVal) 34 | this._localName = localNameVal.toString(); 35 | } else if (localNameVal) { 36 | this._localName = org.apache.flex.utils.Language.string(localNameVal); 37 | this._uri = org.apache.flex.utils.Language.string(qNameOrUri); 38 | } else if (qNameOrUri && qNameOrUri.toString()) { 39 | this._localName = qNameOrUri.toString(); 40 | } 41 | }; 42 | 43 | 44 | /** 45 | * @private 46 | * @type {string} 47 | */ 48 | QName.prototype._uri; 49 | 50 | 51 | /** 52 | * @private 53 | * @type {string} 54 | */ 55 | QName.prototype._localName; 56 | 57 | 58 | /** 59 | * @private 60 | * @type {string} 61 | */ 62 | QName.prototype._prefix; 63 | 64 | 65 | /** 66 | * @export 67 | * @return {string} 68 | */ 69 | QName.prototype.toString = function() { 70 | var /** @type {string} */ uriVal = this._uri ? this._uri : "*"; 71 | return uriVal + "::" + this._localName; 72 | }; 73 | 74 | 75 | /** 76 | * @export 77 | * @param {QName} name 78 | * @return {boolean} 79 | */ 80 | QName.prototype.equals = function(name) { 81 | return this.uri == name.uri && this.localName == name.localName; 82 | }; 83 | 84 | 85 | /** 86 | * @export 87 | * @param {QName} name 88 | * @return {boolean} 89 | */ 90 | QName.prototype.matches = function(name) { 91 | if (this.uri == "*" || name.uri == "*") 92 | return this.localName == "*" || name.localName == "*" || this.localName == name.localName; 93 | if (this.localName == "*" || name.localName == "*") 94 | return this.uri == name.uri; 95 | return this.uri == name.uri && this.localName == name.localName; 96 | }; 97 | 98 | 99 | /** 100 | * @private 101 | * @type {boolean} 102 | */ 103 | QName.prototype._isAttribute; 104 | 105 | 106 | /** 107 | * @export 108 | * @param {Array=} namespaces 109 | * @return {Namespace} 110 | */ 111 | QName.prototype.getNamespace = function(namespaces) { 112 | namespaces = typeof namespaces !== 'undefined' ? namespaces : null; 113 | var /** @type {number} */ i = 0; 114 | var /** @type {Namespace} */ possibleMatch; 115 | if (!namespaces) 116 | namespaces = []; 117 | for (i = 0; i < namespaces.length; i++) { 118 | if (namespaces[i].uri == this._uri) { 119 | possibleMatch = namespaces[i]; 120 | if (namespaces[i].prefix == this._prefix) 121 | return namespaces[i]; 122 | } 123 | } 124 | if (possibleMatch) 125 | return possibleMatch; 126 | if (!this._prefix) 127 | return new Namespace(this._uri); 128 | return new Namespace(this._prefix, this._uri); 129 | }; 130 | 131 | 132 | QName.prototype.get__uri = function() { 133 | return this._uri; 134 | }; 135 | 136 | 137 | QName.prototype.set__uri = function(value) { 138 | this._uri = value; 139 | }; 140 | 141 | 142 | QName.prototype.get__localName = function() { 143 | return this._localName; 144 | }; 145 | 146 | 147 | QName.prototype.set__localName = function(value) { 148 | this._localName = value; 149 | }; 150 | 151 | 152 | QName.prototype.get__prefix = function() { 153 | return this._prefix; 154 | }; 155 | 156 | 157 | QName.prototype.set__prefix = function(value) { 158 | this._prefix = value; 159 | }; 160 | 161 | 162 | QName.prototype.get__isAttribute = function() { 163 | return this._isAttribute; 164 | }; 165 | 166 | 167 | QName.prototype.set__isAttribute = function(value) { 168 | this._isAttribute = value; 169 | }; 170 | 171 | 172 | Object.defineProperties(QName.prototype, /** @lends {QName.prototype} */ { 173 | /** @export */ 174 | uri: { 175 | get: QName.prototype.get__uri, 176 | set: QName.prototype.set__uri}, 177 | /** @export */ 178 | localName: { 179 | get: QName.prototype.get__localName, 180 | set: QName.prototype.set__localName}, 181 | /** @export */ 182 | prefix: { 183 | get: QName.prototype.get__prefix, 184 | set: QName.prototype.set__prefix}, 185 | /** @export */ 186 | isAttribute: { 187 | get: QName.prototype.get__isAttribute, 188 | set: QName.prototype.set__isAttribute}} 189 | ); 190 | 191 | 192 | /** 193 | * Metadata 194 | * 195 | * @type {Object.>} 196 | */ 197 | QName.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'QName', qName: 'QName', kind: 'class' }] }; 198 | 199 | 200 | /** 201 | * Prevent renaming of class. Needed for reflection. 202 | */ 203 | goog.exportSymbol('QName', QName); 204 | 205 | 206 | 207 | /** 208 | * Reflection 209 | * 210 | * @return {Object.} 211 | */ 212 | QName.prototype.FLEXJS_REFLECTION_INFO = function () { 213 | return { 214 | variables: function () {return {};}, 215 | accessors: function () { 216 | return { 217 | 'uri': { type: 'String', access: 'readwrite', declaredBy: 'QName'}, 218 | 'localName': { type: 'String', access: 'readwrite', declaredBy: 'QName'}, 219 | 'prefix': { type: 'String', access: 'readwrite', declaredBy: 'QName'}, 220 | 'isAttribute': { type: 'Boolean', access: 'readwrite', declaredBy: 'QName'} 221 | }; 222 | }, 223 | methods: function () { 224 | return { 225 | 'QName': { type: '', declaredBy: 'QName', parameters: function () { return [ { index: 1, type: '*', optional: true },{ index: 2, type: '*', optional: true } ]; }}, 226 | 'toString': { type: 'String', declaredBy: 'QName'}, 227 | 'equals': { type: 'Boolean', declaredBy: 'QName', parameters: function () { return [ { index: 1, type: 'QName', optional: false } ]; }}, 228 | 'matches': { type: 'Boolean', declaredBy: 'QName', parameters: function () { return [ { index: 1, type: 'QName', optional: false } ]; }}, 229 | 'getNamespace': { type: 'Namespace', declaredBy: 'QName', parameters: function () { return [ { index: 1, type: 'Array', optional: true } ]; }} 230 | }; 231 | } 232 | }; 233 | }; 234 | 235 | //# sourceMappingURL=./QName.js.map -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/Test_BunnyMark.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated by Apache Flex Cross-Compiler from Test_BunnyMark.as 3 | * Test_BunnyMark 4 | * 5 | * @fileoverview 6 | * 7 | * @suppress {checkTypes|accessControls} 8 | */ 9 | 10 | goog.provide('Test_BunnyMark'); 11 | 12 | goog.require('bunnyMark.BackGround'); 13 | goog.require('bunnyMark.BunnyTileTest'); 14 | goog.require('org.apache.flex.utils.Language'); 15 | 16 | 17 | 18 | /** 19 | * @usage this is used for configing emsc module. 20 | * 21 | * 22 | * 35 | * 36 | * @constructor 37 | * @extends {flash.display.Sprite} 38 | */ 39 | Test_BunnyMark = function() { 40 | Test_BunnyMark.base(this, 'constructor'); 41 | if (this.stage) 42 | this.init(null); 43 | else 44 | this.addEventListener(flash.events.Event.ADDED_TO_STAGE, org.apache.flex.utils.Language.closure(this.init, this, 'init'), false, 0, false); 45 | }; 46 | goog.inherits(Test_BunnyMark, flash.display.Sprite, 'Test_BunnyMark'); 47 | 48 | 49 | /** 50 | * @private 51 | * @param {flash.events.Event} e 52 | */ 53 | Test_BunnyMark.prototype.init = function(e) { 54 | this.removeEventListener(flash.events.Event.ADDED_TO_STAGE, org.apache.flex.utils.Language.closure(this.init, this, 'init'), false); 55 | this.addChild(new bunnyMark.BackGround()); 56 | this.addChild(new bunnyMark.BunnyTileTest(5000)); 57 | }; 58 | 59 | 60 | /** 61 | * Metadata 62 | * 63 | * @type {Object.>} 64 | */ 65 | Test_BunnyMark.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Test_BunnyMark', qName: 'Test_BunnyMark', kind: 'class' }] }; 66 | 67 | 68 | /** 69 | * Prevent renaming of class. Needed for reflection. 70 | */ 71 | goog.exportSymbol('Test_BunnyMark', Test_BunnyMark); 72 | 73 | 74 | 75 | /** 76 | * Reflection 77 | * 78 | * @return {Object.} 79 | */ 80 | Test_BunnyMark.prototype.FLEXJS_REFLECTION_INFO = function () { 81 | return { 82 | variables: function () {return {};}, 83 | accessors: function () {return {};}, 84 | methods: function () { 85 | return { 86 | 'Test_BunnyMark': { type: '', declaredBy: 'Test_BunnyMark'} 87 | }; 88 | } 89 | }; 90 | }; 91 | 92 | //# sourceMappingURL=./Test_BunnyMark.js.map -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/Test_BunnyMark.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version":3, 3 | "file":"Test_BunnyMark.js", 4 | "lineCount":57, 5 | "mappings":"A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCkB,cAAhB,WAA8B,CAAC,C,CAC/B,C;;EACC,IAAI,KAAA,KAAK,C;IACR,KAAA,IAAI,CAAC,IAAI,CAAC,C;EACX,I;IACC,KAAA,gBAAgB,CAAC,kBAAK,CAAC,cAAc,E,uCAAE,K,mBAAI,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,C;AAC/D,C;;;;;;;;AAEiB,6BAAjB,WAAqB,CAAC,CAAO,C,CAC7B,C;EACC,KAAA,mBAAmB,CAAC,kBAAK,CAAC,cAAc,E,uCAAE,K,mBAAI,EAAE,KAAK,CAAC,C;EAEtD,KAAA,QAAQ,CAAC,IAAI,oBAAU,CAAC,CAAC,CAAC,C;EAC1B,KAAA,QAAQ,CAAC,IAAI,uBAAa,CAAC,IAAI,CAAC,CAAC,C;AAClC;", 6 | "sources":["..\\..\\src\\Test_BunnyMark.as"], 7 | "names":[] 8 | } 9 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/assets/skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/AJC-bin/as-js-wasm/assets/skin.png -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/bunnyMark/BackGround.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated by Apache Flex Cross-Compiler from bunnyMark\BackGround.as 3 | * bunnyMark.BackGround 4 | * 5 | * @fileoverview 6 | * 7 | * @suppress {checkTypes|accessControls} 8 | */ 9 | 10 | goog.provide('bunnyMark.BackGround'); 11 | goog.require('org.apache.flex.utils.Language'); 12 | 13 | 14 | 15 | /** 16 | * @constructor 17 | * @extends {flash.display.Sprite} 18 | */ 19 | bunnyMark.BackGround = function() { 20 | bunnyMark.BackGround.base(this, 'constructor'); 21 | if (this.stage) 22 | this.init(null); 23 | else 24 | this.addEventListener(flash.events.Event.ADDED_TO_STAGE, org.apache.flex.utils.Language.closure(this.init, this, 'init'), false, 0, false); 25 | }; 26 | goog.inherits(bunnyMark.BackGround, flash.display.Sprite, 'bunnyMark.BackGround'); 27 | 28 | 29 | /** 30 | * @private 31 | * @type {number} 32 | */ 33 | bunnyMark.BackGround.prototype.m_tileWidth = 0; 34 | 35 | 36 | /** 37 | * @private 38 | * @type {number} 39 | */ 40 | bunnyMark.BackGround.prototype.m_tileHeight = 0; 41 | 42 | 43 | /** 44 | * @private 45 | * @type {flash.display.Bitmap} 46 | */ 47 | bunnyMark.BackGround.prototype.m_bitmap; 48 | 49 | 50 | /** 51 | * @private 52 | * @param {flash.events.Event} event 53 | */ 54 | bunnyMark.BackGround.prototype.init = function(event) { 55 | this.removeEventListener(flash.events.Event.ADDED_TO_STAGE, org.apache.flex.utils.Language.closure(this.init, this, 'init'), false); 56 | this.m_tileWidth = 64; 57 | this.m_tileHeight = 64; 58 | var /** @type {flash.display.BitmapData} */ bitmapData = new flash.display.BitmapData(this.m_tileWidth, this.m_tileHeight, false, 0xff000000); 59 | this.m_bitmap = new flash.display.Bitmap(bitmapData); 60 | this.m_bitmap.scaleX = this.stage.stageWidth / this.m_tileWidth; 61 | this.m_bitmap.scaleY = this.stage.stageHeight / this.m_tileHeight; 62 | this.addChild(this.m_bitmap); 63 | this.stage.addEventListener(flash.events.Event.RESIZE, org.apache.flex.utils.Language.closure(this.stageResizeHandler, this, 'stageResizeHandler'), false, 0, false); 64 | this.stage.addEventListener(flash.events.Event.ENTER_FRAME, org.apache.flex.utils.Language.closure(this.enterFrameHandler, this, 'enterFrameHandler'), false, 0, false); 65 | this.addEventListener(flash.events.Event.REMOVED_FROM_STAGE, org.apache.flex.utils.Language.closure(this.removed, this, 'removed'), false, 0, false); 66 | }; 67 | 68 | 69 | /** 70 | * @private 71 | * @param {flash.events.Event} event 72 | */ 73 | bunnyMark.BackGround.prototype.removed = function(event) { 74 | this.removeEventListener(flash.events.Event.REMOVED_FROM_STAGE, org.apache.flex.utils.Language.closure(this.removed, this, 'removed'), false); 75 | this.removeChild(this.m_bitmap); 76 | this.stage.removeEventListener(flash.events.Event.RESIZE, org.apache.flex.utils.Language.closure(this.stageResizeHandler, this, 'stageResizeHandler'), false); 77 | this.stage.removeEventListener(flash.events.Event.ENTER_FRAME, org.apache.flex.utils.Language.closure(this.enterFrameHandler, this, 'enterFrameHandler'), false); 78 | }; 79 | 80 | 81 | /** 82 | * @private 83 | * @param {flash.events.Event} event 84 | */ 85 | bunnyMark.BackGround.prototype.stageResizeHandler = function(event) { 86 | this.m_bitmap.scaleX = this.stage.stageWidth / this.m_tileWidth; 87 | this.m_bitmap.scaleY = this.stage.stageHeight / this.m_tileHeight; 88 | }; 89 | 90 | 91 | /** 92 | * @private 93 | * @param {flash.events.Event} event 94 | */ 95 | bunnyMark.BackGround.prototype.enterFrameHandler = function(event) { 96 | var /** @type {number} */ t = flash.utils.getTimer() / 400.0; 97 | var /** @type {number} */ scale = 4.0; 98 | var /** @type {number} */ wave = Math.PI * 6.0 / Number(this.m_tileHeight); 99 | for (var /** @type {number} */ x = 0; x < this.m_tileWidth; x++) { 100 | for (var /** @type {number} */ y = 0; y < this.m_tileHeight; y++) { 101 | var /** @type {number} */ offsetY = Math.sin(x * wave / 20.0 + t) * 30.0 + Math.sin(x * wave / 5.0 + t * 2) * 5.0; 102 | var /** @type {number} */ offsetX = (2.0 + Math.sin((y + offsetY) * wave + t) + Math.sin((y + offsetY) * wave * 0.7 + t * 2.4)) / 4.0; 103 | var /** @type {flash.display.BitmapData} */ bitmapData = this.m_bitmap.bitmapData; 104 | bitmapData.setPixel(x, y, org.apache.flex.utils.Language.uint(255 * offsetX)); 105 | bitmapData.emsc_delete(); 106 | } 107 | } 108 | }; 109 | 110 | 111 | /** 112 | * Metadata 113 | * 114 | * @type {Object.>} 115 | */ 116 | bunnyMark.BackGround.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'BackGround', qName: 'bunnyMark.BackGround', kind: 'class' }] }; 117 | 118 | 119 | /** 120 | * Prevent renaming of class. Needed for reflection. 121 | */ 122 | goog.exportSymbol('bunnyMark.BackGround', bunnyMark.BackGround); 123 | 124 | 125 | 126 | /** 127 | * Reflection 128 | * 129 | * @return {Object.} 130 | */ 131 | bunnyMark.BackGround.prototype.FLEXJS_REFLECTION_INFO = function () { 132 | return { 133 | variables: function () {return {};}, 134 | accessors: function () {return {};}, 135 | methods: function () { 136 | return { 137 | 'BackGround': { type: '', declaredBy: 'bunnyMark.BackGround'} 138 | }; 139 | } 140 | }; 141 | }; 142 | 143 | //# sourceMappingURL=./BackGround.js.map -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/bunnyMark/BackGround.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version":3, 3 | "file":"BackGround.js", 4 | "lineCount":108, 5 | "mappings":"A;;;;;;;;;;;;;;;;;;AAiBkB,oBAAhB,WAA0B,CAAC,C,CAC3B,C;;EACC,IAAI,KAAA,KAAK,C;IACR,KAAA,IAAI,CAAC,IAAI,CAAC,C;EACX,I;IACC,KAAA,gBAAgB,CAAC,kBAAK,CAAC,cAAc,E,uCAAE,K,mBAAI,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,C;AAC/D,C;;;;;;;;AAVY,0C,IAAe,C;;;;;;;AACf,2C,IAAgB,C;;;;;;;AAChB,uCAAe,C;;;;;;;AAUV,mCAAjB,WAAqB,CAAC,KAAW,C,CACjC,C;EACC,KAAA,mBAAmB,CAAC,kBAAK,CAAC,cAAc,E,uCAAE,K,mBAAI,EAAE,KAAK,CAAC,C;EAGtD,KAAA,WAAW,GAAG,EAAE,C;EAChB,KAAA,YAAY,GAAG,EAAE,C;EAEjB,IAAc,wCAAV,UAAqB,GAAG,IAAI,wBAAU,CAAC,KAAA,WAAW,EAAE,KAAA,YAAY,EAAE,KAAK,EAAE,UAAU,CAAC,C;EACxF,KAAA,QAAQ,GAAG,IAAI,oBAAM,CAAC,UAAU,CAAC,C;EACjC,KAAA,QAAQ,CAAC,MAAM,GAAG,KAAA,KAAK,CAAC,UAAU,GAAG,KAAA,WAAW,C;EAChD,KAAA,QAAQ,CAAC,MAAM,GAAG,KAAA,KAAK,CAAC,WAAW,GAAG,KAAA,YAAY,C;EAElD,KAAA,QAAQ,CAAC,KAAA,QAAQ,CAAC,C;EAElB,KAAA,KAAK,CAAC,gBAAgB,CAAC,kBAAK,CAAC,MAAM,E,uCAAE,K,+CAAkB,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,C;EACzE,KAAA,KAAK,CAAC,gBAAgB,CAAC,kBAAK,CAAC,WAAW,E,uCAAE,K,6CAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,C;EAE7E,KAAA,gBAAgB,CAAC,kBAAK,CAAC,kBAAkB,E,uCAAE,K,yBAAO,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,C;AACrE,C;;;;;;;AACiB,sCAAjB,WAAwB,CAAC,KAAW,C,CACpC,C;EACC,KAAA,mBAAmB,CAAC,kBAAK,CAAC,kBAAkB,E,uCAAE,K,yBAAO,EAAE,KAAK,CAAC,C;EAE7D,KAAA,WAAW,CAAC,KAAA,QAAQ,CAAC,C;EAErB,KAAA,KAAK,CAAC,mBAAmB,CAAC,kBAAK,CAAC,MAAM,E,uCAAE,K,+CAAkB,EAAE,KAAK,CAAC,C;EAClE,KAAA,KAAK,CAAC,mBAAmB,CAAC,kBAAK,CAAC,WAAW,E,uCAAE,K,6CAAiB,EAAE,KAAK,CAAC,C;AACvE,C;;;;;;;AACiB,iDAAjB,WAAmC,CAAC,KAAW,C,CAC/C,C;EACC,KAAA,QAAQ,CAAC,MAAM,GAAG,KAAA,KAAK,CAAC,UAAU,GAAG,KAAA,WAAW,C;EAChD,KAAA,QAAQ,CAAC,MAAM,GAAG,KAAA,KAAK,CAAC,WAAW,GAAG,KAAA,YAAY,C;AACnD,C;;;;;;;AACiB,gDAAjB,WAAkC,CAAC,KAAW,C,CAC9C,C;EACC,IAAK,sBAAD,CAAK,GAAG,oBAAQ,CAAC,CAAC,GAAG,KAAK,C;EAE9B,IAAS,sBAAL,KAAY,GAAG,GAAG,C;EACtB,IAAQ,sBAAJ,IAAW,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,MAAM,CAAC,KAAA,YAAY,CAAC,C;EAEtD,KAAK,IAAK,sBAAD,CAAK,GAAG,CAAC,EAAE,CAAC,GAAG,KAAA,WAAW,EAAE,CAAC,EAAE,EACxC,C;IACC,KAAK,IAAK,sBAAD,CAAK,GAAG,CAAC,EAAE,CAAC,GAAG,KAAA,YAAY,EAAE,CAAC,EAAE,EACzC,C;MACC,IAAW,sBAAP,OAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,C;MAClG,IAAW,sBAAP,OAAc,G,CAAI,GAAG,GAAG,IAAI,CAAC,GAAG,C,CAAE,CAAC,GAAG,O,CAAO,GAAI,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,C,CAAE,CAAC,GAAG,O,CAAO,GAAI,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,C,CAAC,GAAI,GAAG,C;MAEtH,IAAe,wCAAX,UAAsB,GAAG,KAAA,QAAQ,CAAC,UAAU,C;MAChD,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,+BAAA,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,C;MAI7C,UAAU,CAAC,WAAW,CAAC,CAAC,C;IAE1B,C;EACD,C;AACD;", 6 | "sources":["..\\..\\..\\src\\bunnyMark\\BackGround.as"], 7 | "names":[] 8 | } 9 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/bunnyMark/Bunny.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated by Apache Flex Cross-Compiler from bunnyMark\Bunny.as 3 | * bunnyMark.Bunny 4 | * 5 | * @fileoverview 6 | * 7 | * @suppress {checkTypes|accessControls} 8 | */ 9 | 10 | goog.provide('bunnyMark.Bunny'); 11 | goog.require('org.apache.flex.utils.Language'); 12 | 13 | 14 | 15 | /** 16 | * @constructor 17 | * @extends {flash.display.Bitmap} 18 | * @param {flash.display.BitmapData} bitmapData 19 | */ 20 | bunnyMark.Bunny = function(bitmapData) { 21 | bunnyMark.Bunny.base(this, 'constructor', bitmapData); 22 | this.speedX = 0; 23 | this.speedY = 0; 24 | }; 25 | goog.inherits(bunnyMark.Bunny, flash.display.Bitmap, 'bunnyMark.Bunny'); 26 | 27 | 28 | /** 29 | * @export 30 | * @type {number} 31 | */ 32 | bunnyMark.Bunny.prototype.speedX; 33 | 34 | 35 | /** 36 | * @export 37 | * @type {number} 38 | */ 39 | bunnyMark.Bunny.prototype.speedY; 40 | 41 | 42 | /** 43 | * Metadata 44 | * 45 | * @type {Object.>} 46 | */ 47 | bunnyMark.Bunny.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Bunny', qName: 'bunnyMark.Bunny', kind: 'class' }] }; 48 | 49 | 50 | /** 51 | * Prevent renaming of class. Needed for reflection. 52 | */ 53 | goog.exportSymbol('bunnyMark.Bunny', bunnyMark.Bunny); 54 | 55 | 56 | 57 | /** 58 | * Reflection 59 | * 60 | * @return {Object.} 61 | */ 62 | bunnyMark.Bunny.prototype.FLEXJS_REFLECTION_INFO = function () { 63 | return { 64 | variables: function () { 65 | return { 66 | 'speedX': { type: 'Number'}, 67 | 'speedY': { type: 'Number'} 68 | }; 69 | }, 70 | accessors: function () {return {};}, 71 | methods: function () { 72 | return { 73 | 'Bunny': { type: '', declaredBy: 'bunnyMark.Bunny', parameters: function () { return [ { index: 1, type: 'flash.display.BitmapData', optional: false } ]; }} 74 | }; 75 | } 76 | }; 77 | }; 78 | 79 | //# sourceMappingURL=./Bunny.js.map -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/bunnyMark/Bunny.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version":3, 3 | "file":"Bunny.js", 4 | "lineCount":39, 5 | "mappings":"A;;;;;;;;;;;;;;;;;;;AAckB,eAAhB,WAAqB,CAAC,UAAqB,C,CAC3C,C;4CACO,U,CAAW,C;EACjB,KAAA,MAAM,GAAG,CAAC,C;EACV,KAAA,MAAM,GAAG,CAAC,C;AACX,C;;;;;;;;AARW,gCAAa,C;;;;;;;AACb,gCAAa;", 6 | "sources":["..\\..\\..\\src\\bunnyMark\\Bunny.as"], 7 | "names":[] 8 | } 9 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/bunnyMark/BunnyTileTest.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated by Apache Flex Cross-Compiler from bunnyMark\BunnyTileTest.as 3 | * bunnyMark.BunnyTileTest 4 | * 5 | * @fileoverview 6 | * 7 | * @suppress {checkTypes|accessControls} 8 | */ 9 | 10 | goog.provide('bunnyMark.BunnyTileTest'); 11 | 12 | goog.require('bunnyMark.Bunny'); 13 | goog.require('org.apache.flex.utils.Language'); 14 | 15 | 16 | 17 | /** 18 | * @constructor 19 | * @extends {flash.display.Sprite} 20 | * @param {number} numBunnies 21 | */ 22 | bunnyMark.BunnyTileTest = function(numBunnies) { 23 | bunnyMark.BunnyTileTest.base(this, 'constructor'); 24 | this.m_numBunniesIncrease = numBunnies; 25 | if (this.stage) 26 | this.init(null); 27 | else 28 | this.addEventListener(flash.events.Event.ADDED_TO_STAGE, org.apache.flex.utils.Language.closure(this.init, this, 'init')); 29 | }; 30 | goog.inherits(bunnyMark.BunnyTileTest, flash.display.Sprite, 'bunnyMark.BunnyTileTest'); 31 | 32 | 33 | /** 34 | * @private 35 | * @type {number} 36 | */ 37 | bunnyMark.BunnyTileTest.prototype.m_maxX = 0; 38 | 39 | 40 | /** 41 | * @private 42 | * @type {number} 43 | */ 44 | bunnyMark.BunnyTileTest.prototype.m_maxY = 0; 45 | 46 | 47 | /** 48 | * @private 49 | * @type {number} 50 | */ 51 | bunnyMark.BunnyTileTest.prototype.m_minX = 0; 52 | 53 | 54 | /** 55 | * @private 56 | * @type {number} 57 | */ 58 | bunnyMark.BunnyTileTest.prototype.m_minY = 0; 59 | 60 | 61 | /** 62 | * @private 63 | * @type {number} 64 | */ 65 | bunnyMark.BunnyTileTest.prototype.m_gravity; 66 | 67 | 68 | /** 69 | * @private 70 | * @type {number} 71 | */ 72 | bunnyMark.BunnyTileTest.prototype.m_numBunnies = 0; 73 | 74 | 75 | /** 76 | * @private 77 | * @type {number} 78 | */ 79 | bunnyMark.BunnyTileTest.prototype.m_numBunniesIncrease = 0; 80 | 81 | 82 | /** 83 | * @private 84 | * @type {Array} 85 | */ 86 | bunnyMark.BunnyTileTest.prototype.m_bunnies_vector; 87 | 88 | 89 | /** 90 | * @private 91 | * @type {flash.display.BitmapData} 92 | */ 93 | bunnyMark.BunnyTileTest.prototype.m_bunnyBitmapData; 94 | 95 | 96 | /** 97 | * @private 98 | * @param {flash.events.Event} e 99 | */ 100 | bunnyMark.BunnyTileTest.prototype.init = function(e) { 101 | this.removeEventListener(flash.events.Event.ADDED_TO_STAGE, org.apache.flex.utils.Language.closure(this.init, this, 'init')); 102 | this.m_gravity = 0.5; 103 | this.m_minX = this.m_minY = this.m_numBunnies = 0; 104 | this.m_bunnyBitmapData = new flash.display.BitmapData(26, 37, true, 0xff000000); 105 | this.m_bunnies_vector = org.apache.flex.utils.Language.Vector(); 106 | var /** @type {flash.display.Loader} */ loader = new flash.display.Loader(); 107 | loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, org.apache.flex.utils.Language.closure(this.loaderCompleteHandler, this, 'loaderCompleteHandler')); 108 | loader.load(new flash.net.URLRequest("./assets/skin.png")); 109 | this.stageResizeHandler(null); 110 | this.stageClickHandler(null); 111 | this.stage.addEventListener(flash.events.Event.ENTER_FRAME, org.apache.flex.utils.Language.closure(this.enterFrameHandler, this, 'enterFrameHandler')); 112 | this.stage.addEventListener(flash.events.Event.RESIZE, org.apache.flex.utils.Language.closure(this.stageResizeHandler, this, 'stageResizeHandler')); 113 | this.stage.addEventListener(flash.events.MouseEvent.CLICK, org.apache.flex.utils.Language.closure(this.stageClickHandler, this, 'stageClickHandler')); 114 | }; 115 | 116 | 117 | /** 118 | * @private 119 | * @param {flash.events.Event} e 120 | */ 121 | bunnyMark.BunnyTileTest.prototype.loaderCompleteHandler = function(e) { 122 | e.target.removeEventListener(flash.events.Event.COMPLETE, org.apache.flex.utils.Language.closure(this.loaderCompleteHandler, this, 'loaderCompleteHandler')); 123 | var /** @type {flash.display.LoaderInfo} */ loaderInfo = org.apache.flex.utils.Language.as(e.target, flash.display.LoaderInfo); 124 | var /** @type {flash.display.Bitmap} */ bitmap = org.apache.flex.utils.Language.as(loaderInfo.content, flash.display.Bitmap); 125 | this.m_bunnyBitmapData = bitmap.bitmapData; 126 | for (var /** @type {number} */ i = 0; i < this.m_numBunnies; i++) { 127 | var /** @type {bunnyMark.Bunny} */ bunny = this.m_bunnies_vector[i]; 128 | if (bunny) 129 | bunny.bitmapData = this.m_bunnyBitmapData; 130 | } 131 | }; 132 | 133 | 134 | /** 135 | * @private 136 | * @param {flash.events.Event} e 137 | */ 138 | bunnyMark.BunnyTileTest.prototype.enterFrameHandler = function(e) { 139 | for (var /** @type {number} */ i = 0; i < this.m_numBunnies; i++) { 140 | var /** @type {bunnyMark.Bunny} */ bunny = this.m_bunnies_vector[i]; 141 | bunny.x += bunny.speedX; 142 | bunny.y += bunny.speedY; 143 | bunny.speedY += this.m_gravity; 144 | if (bunny.x > this.m_maxX) { 145 | bunny.speedX *= -1.0; 146 | bunny.x = this.m_maxX; 147 | } else if (bunny.x < this.m_minX) { 148 | bunny.speedX *= -1.0; 149 | bunny.x = this.m_minX; 150 | } 151 | if (bunny.y > this.m_maxY) { 152 | bunny.speedY *= -0.8; 153 | bunny.y = this.m_maxY; 154 | if (Math.random() > 0.5) 155 | bunny.speedY -= 3 + Math.random() * 4; 156 | } else if (bunny.y < this.m_minY) { 157 | bunny.speedY = 0; 158 | bunny.y = this.m_minY; 159 | } 160 | } 161 | }; 162 | 163 | 164 | /** 165 | * @private 166 | * @param {flash.events.Event} e 167 | */ 168 | bunnyMark.BunnyTileTest.prototype.stageResizeHandler = function(e) { 169 | this.m_maxX = this.stage.stageWidth; 170 | this.m_maxY = this.stage.stageHeight; 171 | }; 172 | 173 | 174 | /** 175 | * @export 176 | * @param {flash.events.Event} e 177 | */ 178 | bunnyMark.BunnyTileTest.prototype.stageClickHandler = function(e) { 179 | this.m_numBunnies += this.m_numBunniesIncrease; 180 | for (var /** @type {number} */ i = 0; i < this.m_numBunniesIncrease; i++) { 181 | var /** @type {bunnyMark.Bunny} */ bunny = new bunnyMark.Bunny(this.m_bunnyBitmapData); 182 | bunny.speedX = Math.random() * 5.0; 183 | bunny.speedY = Math.random() * 5.0 - 2.5; 184 | var /** @type {number} */ scaleRand = 0.3 + Math.random(); 185 | bunny.scaleX = scaleRand; 186 | bunny.scaleY = scaleRand; 187 | bunny.rotation = 120.0 * (15.0 - Math.random() * 30.0); 188 | this.addChild(bunny); 189 | this.m_bunnies_vector.push(bunny); 190 | } 191 | }; 192 | 193 | 194 | /** 195 | * Metadata 196 | * 197 | * @type {Object.>} 198 | */ 199 | bunnyMark.BunnyTileTest.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'BunnyTileTest', qName: 'bunnyMark.BunnyTileTest', kind: 'class' }] }; 200 | 201 | 202 | /** 203 | * Prevent renaming of class. Needed for reflection. 204 | */ 205 | goog.exportSymbol('bunnyMark.BunnyTileTest', bunnyMark.BunnyTileTest); 206 | 207 | 208 | 209 | /** 210 | * Reflection 211 | * 212 | * @return {Object.} 213 | */ 214 | bunnyMark.BunnyTileTest.prototype.FLEXJS_REFLECTION_INFO = function () { 215 | return { 216 | variables: function () {return {};}, 217 | accessors: function () {return {};}, 218 | methods: function () { 219 | return { 220 | 'BunnyTileTest': { type: '', declaredBy: 'bunnyMark.BunnyTileTest', parameters: function () { return [ { index: 1, type: 'uint', optional: false } ]; }}, 221 | 'stageClickHandler': { type: 'void', declaredBy: 'bunnyMark.BunnyTileTest', parameters: function () { return [ { index: 1, type: 'flash.events.Event', optional: false } ]; }} 222 | }; 223 | } 224 | }; 225 | }; 226 | 227 | //# sourceMappingURL=./BunnyTileTest.js.map -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/bunnyMark/BunnyTileTest.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version":3, 3 | "file":"BunnyTileTest.js", 4 | "lineCount":191, 5 | "mappings":"A;;;;;;;;;;;;;;;;;;;;;AA6BkB,uBAAhB,WAA6B,CAAC,UAAe,C,CAC7C,C;;EACC,KAAA,oBAAoB,GAAG,UAAU,C;EACjC,IAAI,KAAA,KAAK,C;IACR,KAAA,IAAI,CAAC,IAAI,CAAC,C;EACX,I;IACC,KAAA,gBAAgB,CAAC,kBAAK,CAAC,cAAc,E,uCAAE,K,mBAAI,CAAC,C;AAC9C,C;;;;;;;;AAnBY,wC,IAAU,C;;;;;;;AACV,wC,IAAU,C;;;;;;;AACV,wC,IAAU,C;;;;;;;AACV,wC,IAAU,C;;;;;;;AACV,2CAAgB,C;;;;;;;AAChB,8C,IAAgB,C;;;;;;;AAChB,sD,IAAwB,C;;;;;;;AAExB,kDAA+B,C;;;;;;;AAC/B,mDAA4B,C;;;;;;;AAWvB,sCAAjB,WAAqB,CAAC,CAAO,C,CAC7B,C;EACC,KAAA,mBAAmB,CAAC,kBAAK,CAAC,cAAc,E,uCAAE,K,mBAAI,CAAC,C;EAE/C,KAAA,SAAS,GAAG,GAAG,C;EACf,KAAA,MAAM,GAAG,KAAA,MAAM,GAAG,KAAA,YAAY,GAAE,CAAC,C;EAEjC,KAAA,iBAAiB,GAAG,IAAI,wBAAU,CAAC,EAAE,EAAE,EAAE,EAAC,IAAI,EAAE,UAAU,CAAC,C;EAC3D,KAAA,gBAAgB,G,qCAAqB,CAAC,CAAC,C;EAEvC,IAAU,oCAAN,MAAa,GAAG,IAAI,oBAAM,CAAC,CAAC,C;EAChC,MAAM,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,kBAAK,CAAC,QAAQ,E,uCAAE,K,qDAAqB,CAAC,C;EAChF,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAU,CAAC,mBAAmB,CAAC,CAAC,C;EAEhD,KAAA,kBAAkB,CAAC,IAAI,CAAC,C;EACxB,KAAA,iBAAiB,CAAC,IAAI,CAAC,C;EAEvB,KAAA,KAAK,CAAC,gBAAgB,CAAC,kBAAK,CAAC,WAAW,E,uCAAE,K,6CAAiB,CAAC,C;EAC5D,KAAA,KAAK,CAAC,gBAAgB,CAAC,kBAAK,CAAC,MAAM,E,uCAAE,K,+CAAkB,CAAC,C;EACxD,KAAA,KAAK,CAAC,gBAAgB,CAAC,uBAAU,CAAC,KAAK,E,uCAAE,K,6CAAiB,CAAC,C;AAE5D,C;;;;;;;AAEiB,uDAAjB,WAAsC,CAAC,CAAO,C,CAC9C,C;EACC,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,kBAAK,CAAC,QAAQ,E,uCAAE,K,qDAAqB,CAAC,C;EAEnE,IAAc,wCAAV,UAAqB,GAAW,kCAAR,CAAC,CAAC,MAAM,EAAI,wBAAJ,CAAc,C;EAElD,IAAU,oCAAN,MAAa,GAAqB,kCAAlB,UAAU,CAAC,OAAO,EAAI,oBAAJ,CAAU,C;EAEhD,KAAA,iBAAiB,GAAG,MAAM,CAAC,UAAU,C;EAErC,KAAK,IAAK,sBAAD,CAAK,GAAG,CAAC,EAAE,CAAC,GAAG,KAAA,YAAY,EAAE,CAAC,EAAG,EAC1C,C;IACC,IAAS,+BAAL,KAAW,GAAG,KAAA,gBAAgB,CAAC,CAAC,CAAC,C;IACrC,IAAI,KAAK,C;MACR,KAAK,CAAC,UAAU,GAAG,KAAA,iBAAiB,C;EACtC,C;AACD,C;;;;;;;AAEiB,mDAAjB,WAAkC,CAAC,CAAO,C,CAC1C,C;EACC,KAAK,IAAK,sBAAD,CAAK,GAAG,CAAC,EAAE,CAAC,GAAG,KAAA,YAAY,EAAE,CAAC,EAAG,EAC1C,C;IACC,IAAS,+BAAL,KAAW,GAAG,KAAA,gBAAgB,CAAC,CAAC,CAAC,C;IACrC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,C;IACvB,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,C;IACvB,KAAK,CAAC,MAAM,IAAI,KAAA,SAAS,C;IAEzB,IAAI,KAAK,CAAC,CAAC,GAAG,KAAA,MAAM,EACpB,C;MACC,KAAK,CAAC,MAAM,IAAI,IAAC,C;MACjB,KAAK,CAAC,CAAC,GAAG,KAAA,MAAM,C;IACjB,C,CACA,SAAS,KAAK,CAAC,CAAC,GAAG,KAAA,MAAM,EACzB,C;MACC,KAAK,CAAC,MAAM,IAAI,IAAC,C;MACjB,KAAK,CAAC,CAAC,GAAG,KAAA,MAAM,C;IACjB,C;IACA,IAAI,KAAK,CAAC,CAAC,GAAG,KAAA,MAAM,EACpB,C;MACC,KAAK,CAAC,MAAM,IAAI,IAAC,C;MACjB,KAAK,CAAC,CAAC,GAAG,KAAA,MAAM,C;MAEhB,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,C;QAAE,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,C;IAC/D,C,CACA,SAAS,KAAK,CAAC,CAAC,GAAG,KAAA,MAAM,EACzB,C;MACC,KAAK,CAAC,MAAM,GAAG,CAAC,C;MAChB,KAAK,CAAC,CAAC,GAAG,KAAA,MAAM,C;IACjB,C;EACD,C;AACD,C;;;;;;;AAEiB,oDAAjB,WAAmC,CAAC,CAAO,C,CAC3C,C;EACC,KAAA,MAAM,GAAG,KAAA,KAAK,CAAC,UAAU,C;EACzB,KAAA,MAAM,GAAG,KAAA,KAAK,CAAC,WAAW,C;AAC3B,C;;;;;;;AAEgB,mDAAhB,WAAiC,CAAC,CAAO,C,CACzC,C;EACC,KAAA,YAAY,IAAI,KAAA,oBAAoB,C;EAEpC,KAAK,IAAM,sBAAF,CAAM,GAAG,CAAC,EAAG,CAAC,GAAG,KAAA,oBAAmB,EAAG,CAAC,EAAG,EACpD,C;IACC,IAAS,+BAAL,KAAW,GAAG,IAAI,eAAK,CAAC,KAAA,iBAAiB,CAAC,C;IAE9C,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,C;IAClC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,C;IAExC,IAAa,sBAAT,SAAgB,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,C;IAC1C,KAAK,CAAC,MAAM,GAAG,SAAS,C;IACxB,KAAK,CAAC,MAAM,GAAG,SAAS,C;IAExB,KAAK,CAAC,QAAQ,GAAG,KAAK,G,CAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,I,CAAI,C;IAErD,KAAA,QAAQ,CAAC,KAAK,CAAC,C;IACf,KAAA,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,C;EAC7B,C;AAED;", 6 | "sources":["..\\..\\..\\src\\bunnyMark\\BunnyTileTest.as"], 7 | "names":[] 8 | } 9 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 11 | 24 | 25 | 26 | 27 | 40 | 41 | 42 | 45 | 46 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/bootstrap/nodejs.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview A nodejs script for dynamically requiring Closure within 17 | * nodejs. 18 | * 19 | * Example of usage: 20 | * 21 | * require('./bootstrap/nodejs') 22 | * goog.require('goog.ui.Component') 23 | * 24 | * 25 | * This loads goog.ui.Component in the global scope. 26 | * 27 | * If you want to load custom libraries, you can require the custom deps file 28 | * directly. If your custom libraries introduce new globals, you may 29 | * need to run goog.nodeGlobalRequire to get them to load correctly. 30 | * 31 | * 32 | * require('./path/to/my/deps.js') 33 | * goog.bootstrap.nodeJs.nodeGlobalRequire('./path/to/my/base.js') 34 | * goog.require('my.Class') 35 | * 36 | * 37 | * @author nick@medium.com (Nick Santos) 38 | * 39 | * @nocompile 40 | */ 41 | 42 | 43 | var fs = require('fs'); 44 | var path = require('path'); 45 | var vm = require('vm'); 46 | 47 | 48 | /** 49 | * The goog namespace in the global scope. 50 | */ 51 | global.goog = {}; 52 | 53 | 54 | /** 55 | * Imports a script using Node's require() API. 56 | * 57 | * @param {string} src The script source. 58 | * @param {string=} opt_sourceText The optional source text to evaluate. 59 | * @return {boolean} True if the script was imported, false otherwise. 60 | */ 61 | global.CLOSURE_IMPORT_SCRIPT = function(src, opt_sourceText) { 62 | // Sources are always expressed relative to closure's base.js, but 63 | // require() is always relative to the current source. 64 | if (opt_sourceText === undefined) { 65 | require('./../' + src); 66 | } else { 67 | eval(opt_sourceText); 68 | } 69 | return true; 70 | }; 71 | 72 | 73 | /** 74 | * Loads a file when using Closure's goog.require() API with goog.modules. 75 | * 76 | * @param {string} src The file source. 77 | * @return {string} The file contents. 78 | */ 79 | global.CLOSURE_LOAD_FILE_SYNC = function(src) { 80 | return fs.readFileSync( 81 | path.resolve(__dirname, '..', src), {encoding: 'utf-8'}); 82 | }; 83 | 84 | 85 | // Declared here so it can be used to require base.js 86 | function nodeGlobalRequire(file) { 87 | vm.runInThisContext.call(global, fs.readFileSync(file), file); 88 | } 89 | 90 | 91 | // Load Closure's base.js into memory. It is assumed base.js is in the 92 | // directory above this directory given this script's location in 93 | // bootstrap/nodejs.js. 94 | nodeGlobalRequire(path.resolve(__dirname, '..', 'base.js')); 95 | 96 | 97 | /** 98 | * Bootstraps a file into the global scope. 99 | * 100 | * This is strictly for cases where normal require() won't work, 101 | * because the file declares global symbols with 'var' that need to 102 | * be added to the global scope. 103 | * @suppress {missingProvide} 104 | * 105 | * @param {string} file The path to the file. 106 | */ 107 | goog.nodeGlobalRequire = nodeGlobalRequire; 108 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/debug/entrypointregistry.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview A global registry for entry points into a program, 17 | * so that they can be instrumented. Each module should register their 18 | * entry points with this registry. Designed to be compiled out 19 | * if no instrumentation is requested. 20 | * 21 | * Entry points may be registered before or after a call to 22 | * goog.debug.entryPointRegistry.monitorAll. If an entry point is registered 23 | * later, the existing monitor will instrument the new entry point. 24 | * 25 | * @author nicksantos@google.com (Nick Santos) 26 | */ 27 | 28 | goog.provide('goog.debug.EntryPointMonitor'); 29 | goog.provide('goog.debug.entryPointRegistry'); 30 | 31 | goog.require('goog.asserts'); 32 | 33 | 34 | 35 | /** 36 | * @interface 37 | */ 38 | goog.debug.EntryPointMonitor = function() {}; 39 | 40 | 41 | /** 42 | * Instruments a function. 43 | * 44 | * @param {!Function} fn A function to instrument. 45 | * @return {!Function} The instrumented function. 46 | */ 47 | goog.debug.EntryPointMonitor.prototype.wrap; 48 | 49 | 50 | /** 51 | * Try to remove an instrumentation wrapper created by this monitor. 52 | * If the function passed to unwrap is not a wrapper created by this 53 | * monitor, then we will do nothing. 54 | * 55 | * Notice that some wrappers may not be unwrappable. For example, if other 56 | * monitors have applied their own wrappers, then it will be impossible to 57 | * unwrap them because their wrappers will have captured our wrapper. 58 | * 59 | * So it is important that entry points are unwrapped in the reverse 60 | * order that they were wrapped. 61 | * 62 | * @param {!Function} fn A function to unwrap. 63 | * @return {!Function} The unwrapped function, or {@code fn} if it was not 64 | * a wrapped function created by this monitor. 65 | */ 66 | goog.debug.EntryPointMonitor.prototype.unwrap; 67 | 68 | 69 | /** 70 | * An array of entry point callbacks. 71 | * @type {!Array} 72 | * @private 73 | */ 74 | goog.debug.entryPointRegistry.refList_ = []; 75 | 76 | 77 | /** 78 | * Monitors that should wrap all the entry points. 79 | * @type {!Array} 80 | * @private 81 | */ 82 | goog.debug.entryPointRegistry.monitors_ = []; 83 | 84 | 85 | /** 86 | * Whether goog.debug.entryPointRegistry.monitorAll has ever been called. 87 | * Checking this allows the compiler to optimize out the registrations. 88 | * @type {boolean} 89 | * @private 90 | */ 91 | goog.debug.entryPointRegistry.monitorsMayExist_ = false; 92 | 93 | 94 | /** 95 | * Register an entry point with this module. 96 | * 97 | * The entry point will be instrumented when a monitor is passed to 98 | * goog.debug.entryPointRegistry.monitorAll. If this has already occurred, the 99 | * entry point is instrumented immediately. 100 | * 101 | * @param {function(!Function)} callback A callback function which is called 102 | * with a transforming function to instrument the entry point. The callback 103 | * is responsible for wrapping the relevant entry point with the 104 | * transforming function. 105 | */ 106 | goog.debug.entryPointRegistry.register = function(callback) { 107 | // Don't use push(), so that this can be compiled out. 108 | goog.debug.entryPointRegistry 109 | .refList_[goog.debug.entryPointRegistry.refList_.length] = callback; 110 | // If no one calls monitorAll, this can be compiled out. 111 | if (goog.debug.entryPointRegistry.monitorsMayExist_) { 112 | var monitors = goog.debug.entryPointRegistry.monitors_; 113 | for (var i = 0; i < monitors.length; i++) { 114 | callback(goog.bind(monitors[i].wrap, monitors[i])); 115 | } 116 | } 117 | }; 118 | 119 | 120 | /** 121 | * Configures a monitor to wrap all entry points. 122 | * 123 | * Entry points that have already been registered are immediately wrapped by 124 | * the monitor. When an entry point is registered in the future, it will also 125 | * be wrapped by the monitor when it is registered. 126 | * 127 | * @param {!goog.debug.EntryPointMonitor} monitor An entry point monitor. 128 | */ 129 | goog.debug.entryPointRegistry.monitorAll = function(monitor) { 130 | goog.debug.entryPointRegistry.monitorsMayExist_ = true; 131 | var transformer = goog.bind(monitor.wrap, monitor); 132 | for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) { 133 | goog.debug.entryPointRegistry.refList_[i](transformer); 134 | } 135 | goog.debug.entryPointRegistry.monitors_.push(monitor); 136 | }; 137 | 138 | 139 | /** 140 | * Try to unmonitor all the entry points that have already been registered. If 141 | * an entry point is registered in the future, it will not be wrapped by the 142 | * monitor when it is registered. Note that this may fail if the entry points 143 | * have additional wrapping. 144 | * 145 | * @param {!goog.debug.EntryPointMonitor} monitor The last monitor to wrap 146 | * the entry points. 147 | * @throws {Error} If the monitor is not the most recently configured monitor. 148 | */ 149 | goog.debug.entryPointRegistry.unmonitorAllIfPossible = function(monitor) { 150 | var monitors = goog.debug.entryPointRegistry.monitors_; 151 | goog.asserts.assert( 152 | monitor == monitors[monitors.length - 1], 153 | 'Only the most recent monitor can be unwrapped.'); 154 | var transformer = goog.bind(monitor.unwrap, monitor); 155 | for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) { 156 | goog.debug.entryPointRegistry.refList_[i](transformer); 157 | } 158 | monitors.length--; 159 | }; 160 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/debug/error.js: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Provides a base class for custom Error objects such that the 17 | * stack is correctly maintained. 18 | * 19 | * You should never need to throw goog.debug.Error(msg) directly, Error(msg) is 20 | * sufficient. 21 | * 22 | */ 23 | 24 | goog.provide('goog.debug.Error'); 25 | 26 | 27 | 28 | /** 29 | * Base class for custom error objects. 30 | * @param {*=} opt_msg The message associated with the error. 31 | * @constructor 32 | * @extends {Error} 33 | */ 34 | goog.debug.Error = function(opt_msg) { 35 | 36 | // Attempt to ensure there is a stack trace. 37 | if (Error.captureStackTrace) { 38 | Error.captureStackTrace(this, goog.debug.Error); 39 | } else { 40 | var stack = new Error().stack; 41 | if (stack) { 42 | this.stack = stack; 43 | } 44 | } 45 | 46 | if (opt_msg) { 47 | this.message = String(opt_msg); 48 | } 49 | 50 | /** 51 | * Whether to report this error to the server. Setting this to false will 52 | * cause the error reporter to not report the error back to the server, 53 | * which can be useful if the client knows that the error has already been 54 | * logged on the server. 55 | * @type {boolean} 56 | */ 57 | this.reportErrorToServer = true; 58 | }; 59 | goog.inherits(goog.debug.Error, Error); 60 | 61 | 62 | /** @override */ 63 | goog.debug.Error.prototype.name = 'CustomError'; 64 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/disposable/disposable.js: -------------------------------------------------------------------------------- 1 | // Copyright 2005 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Implements the disposable interface. The dispose method is used 17 | * to clean up references and resources. 18 | * @author arv@google.com (Erik Arvidsson) 19 | */ 20 | 21 | 22 | goog.provide('goog.Disposable'); 23 | goog.provide('goog.dispose'); 24 | goog.provide('goog.disposeAll'); 25 | 26 | goog.require('goog.disposable.IDisposable'); 27 | 28 | 29 | 30 | /** 31 | * Class that provides the basic implementation for disposable objects. If your 32 | * class holds one or more references to COM objects, DOM nodes, or other 33 | * disposable objects, it should extend this class or implement the disposable 34 | * interface (defined in goog.disposable.IDisposable). 35 | * @constructor 36 | * @implements {goog.disposable.IDisposable} 37 | */ 38 | goog.Disposable = function() { 39 | /** 40 | * If monitoring the goog.Disposable instances is enabled, stores the creation 41 | * stack trace of the Disposable instance. 42 | * @type {string|undefined} 43 | */ 44 | this.creationStack; 45 | 46 | if (goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF) { 47 | if (goog.Disposable.INCLUDE_STACK_ON_CREATION) { 48 | this.creationStack = new Error().stack; 49 | } 50 | goog.Disposable.instances_[goog.getUid(this)] = this; 51 | } 52 | // Support sealing 53 | this.disposed_ = this.disposed_; 54 | this.onDisposeCallbacks_ = this.onDisposeCallbacks_; 55 | }; 56 | 57 | 58 | /** 59 | * @enum {number} Different monitoring modes for Disposable. 60 | */ 61 | goog.Disposable.MonitoringMode = { 62 | /** 63 | * No monitoring. 64 | */ 65 | OFF: 0, 66 | /** 67 | * Creating and disposing the goog.Disposable instances is monitored. All 68 | * disposable objects need to call the {@code goog.Disposable} base 69 | * constructor. The PERMANENT mode must be switched on before creating any 70 | * goog.Disposable instances. 71 | */ 72 | PERMANENT: 1, 73 | /** 74 | * INTERACTIVE mode can be switched on and off on the fly without producing 75 | * errors. It also doesn't warn if the disposable objects don't call the 76 | * {@code goog.Disposable} base constructor. 77 | */ 78 | INTERACTIVE: 2 79 | }; 80 | 81 | 82 | /** 83 | * @define {number} The monitoring mode of the goog.Disposable 84 | * instances. Default is OFF. Switching on the monitoring is only 85 | * recommended for debugging because it has a significant impact on 86 | * performance and memory usage. If switched off, the monitoring code 87 | * compiles down to 0 bytes. 88 | */ 89 | goog.define('goog.Disposable.MONITORING_MODE', 0); 90 | 91 | 92 | /** 93 | * @define {boolean} Whether to attach creation stack to each created disposable 94 | * instance; This is only relevant for when MonitoringMode != OFF. 95 | */ 96 | goog.define('goog.Disposable.INCLUDE_STACK_ON_CREATION', true); 97 | 98 | 99 | /** 100 | * Maps the unique ID of every undisposed {@code goog.Disposable} object to 101 | * the object itself. 102 | * @type {!Object} 103 | * @private 104 | */ 105 | goog.Disposable.instances_ = {}; 106 | 107 | 108 | /** 109 | * @return {!Array} All {@code goog.Disposable} objects that 110 | * haven't been disposed of. 111 | */ 112 | goog.Disposable.getUndisposedObjects = function() { 113 | var ret = []; 114 | for (var id in goog.Disposable.instances_) { 115 | if (goog.Disposable.instances_.hasOwnProperty(id)) { 116 | ret.push(goog.Disposable.instances_[Number(id)]); 117 | } 118 | } 119 | return ret; 120 | }; 121 | 122 | 123 | /** 124 | * Clears the registry of undisposed objects but doesn't dispose of them. 125 | */ 126 | goog.Disposable.clearUndisposedObjects = function() { 127 | goog.Disposable.instances_ = {}; 128 | }; 129 | 130 | 131 | /** 132 | * Whether the object has been disposed of. 133 | * @type {boolean} 134 | * @private 135 | */ 136 | goog.Disposable.prototype.disposed_ = false; 137 | 138 | 139 | /** 140 | * Callbacks to invoke when this object is disposed. 141 | * @type {Array} 142 | * @private 143 | */ 144 | goog.Disposable.prototype.onDisposeCallbacks_; 145 | 146 | 147 | /** 148 | * @return {boolean} Whether the object has been disposed of. 149 | * @override 150 | */ 151 | goog.Disposable.prototype.isDisposed = function() { 152 | return this.disposed_; 153 | }; 154 | 155 | 156 | /** 157 | * @return {boolean} Whether the object has been disposed of. 158 | * @deprecated Use {@link #isDisposed} instead. 159 | */ 160 | goog.Disposable.prototype.getDisposed = goog.Disposable.prototype.isDisposed; 161 | 162 | 163 | /** 164 | * Disposes of the object. If the object hasn't already been disposed of, calls 165 | * {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should 166 | * override {@link #disposeInternal} in order to delete references to COM 167 | * objects, DOM nodes, and other disposable objects. Reentrant. 168 | * 169 | * @return {void} Nothing. 170 | * @override 171 | */ 172 | goog.Disposable.prototype.dispose = function() { 173 | if (!this.disposed_) { 174 | // Set disposed_ to true first, in case during the chain of disposal this 175 | // gets disposed recursively. 176 | this.disposed_ = true; 177 | this.disposeInternal(); 178 | if (goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF) { 179 | var uid = goog.getUid(this); 180 | if (goog.Disposable.MONITORING_MODE == 181 | goog.Disposable.MonitoringMode.PERMANENT && 182 | !goog.Disposable.instances_.hasOwnProperty(uid)) { 183 | throw Error( 184 | this + ' did not call the goog.Disposable base ' + 185 | 'constructor or was disposed of after a clearUndisposedObjects ' + 186 | 'call'); 187 | } 188 | delete goog.Disposable.instances_[uid]; 189 | } 190 | } 191 | }; 192 | 193 | 194 | /** 195 | * Associates a disposable object with this object so that they will be disposed 196 | * together. 197 | * @param {goog.disposable.IDisposable} disposable that will be disposed when 198 | * this object is disposed. 199 | */ 200 | goog.Disposable.prototype.registerDisposable = function(disposable) { 201 | this.addOnDisposeCallback(goog.partial(goog.dispose, disposable)); 202 | }; 203 | 204 | 205 | /** 206 | * Invokes a callback function when this object is disposed. Callbacks are 207 | * invoked in the order in which they were added. If a callback is added to 208 | * an already disposed Disposable, it will be called immediately. 209 | * @param {function(this:T):?} callback The callback function. 210 | * @param {T=} opt_scope An optional scope to call the callback in. 211 | * @template T 212 | */ 213 | goog.Disposable.prototype.addOnDisposeCallback = function(callback, opt_scope) { 214 | if (this.disposed_) { 215 | goog.isDef(opt_scope) ? callback.call(opt_scope) : callback(); 216 | return; 217 | } 218 | if (!this.onDisposeCallbacks_) { 219 | this.onDisposeCallbacks_ = []; 220 | } 221 | 222 | this.onDisposeCallbacks_.push( 223 | goog.isDef(opt_scope) ? goog.bind(callback, opt_scope) : callback); 224 | }; 225 | 226 | 227 | /** 228 | * Deletes or nulls out any references to COM objects, DOM nodes, or other 229 | * disposable objects. Classes that extend {@code goog.Disposable} should 230 | * override this method. 231 | * Not reentrant. To avoid calling it twice, it must only be called from the 232 | * subclass' {@code disposeInternal} method. Everywhere else the public 233 | * {@code dispose} method must be used. 234 | * For example: 235 | *
236 |  *   mypackage.MyClass = function() {
237 |  *     mypackage.MyClass.base(this, 'constructor');
238 |  *     // Constructor logic specific to MyClass.
239 |  *     ...
240 |  *   };
241 |  *   goog.inherits(mypackage.MyClass, goog.Disposable);
242 |  *
243 |  *   mypackage.MyClass.prototype.disposeInternal = function() {
244 |  *     // Dispose logic specific to MyClass.
245 |  *     ...
246 |  *     // Call superclass's disposeInternal at the end of the subclass's, like
247 |  *     // in C++, to avoid hard-to-catch issues.
248 |  *     mypackage.MyClass.base(this, 'disposeInternal');
249 |  *   };
250 |  * 
251 | * @protected 252 | */ 253 | goog.Disposable.prototype.disposeInternal = function() { 254 | if (this.onDisposeCallbacks_) { 255 | while (this.onDisposeCallbacks_.length) { 256 | this.onDisposeCallbacks_.shift()(); 257 | } 258 | } 259 | }; 260 | 261 | 262 | /** 263 | * Returns True if we can verify the object is disposed. 264 | * Calls {@code isDisposed} on the argument if it supports it. If obj 265 | * is not an object with an isDisposed() method, return false. 266 | * @param {*} obj The object to investigate. 267 | * @return {boolean} True if we can verify the object is disposed. 268 | */ 269 | goog.Disposable.isDisposed = function(obj) { 270 | if (obj && typeof obj.isDisposed == 'function') { 271 | return obj.isDisposed(); 272 | } 273 | return false; 274 | }; 275 | 276 | 277 | /** 278 | * Calls {@code dispose} on the argument if it supports it. If obj is not an 279 | * object with a dispose() method, this is a no-op. 280 | * @param {*} obj The object to dispose of. 281 | */ 282 | goog.dispose = function(obj) { 283 | if (obj && typeof obj.dispose == 'function') { 284 | obj.dispose(); 285 | } 286 | }; 287 | 288 | 289 | /** 290 | * Calls {@code dispose} on each member of the list that supports it. (If the 291 | * member is an ArrayLike, then {@code goog.disposeAll()} will be called 292 | * recursively on each of its members.) If the member is not an object with a 293 | * {@code dispose()} method, then it is ignored. 294 | * @param {...*} var_args The list. 295 | */ 296 | goog.disposeAll = function(var_args) { 297 | for (var i = 0, len = arguments.length; i < len; ++i) { 298 | var disposable = arguments[i]; 299 | if (goog.isArrayLike(disposable)) { 300 | goog.disposeAll.apply(null, disposable); 301 | } else { 302 | goog.dispose(disposable); 303 | } 304 | } 305 | }; 306 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/disposable/idisposable.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Definition of the disposable interface. A disposable object 17 | * has a dispose method to to clean up references and resources. 18 | * @author nnaze@google.com (Nathan Naze) 19 | */ 20 | 21 | 22 | goog.provide('goog.disposable.IDisposable'); 23 | 24 | 25 | 26 | /** 27 | * Interface for a disposable object. If a instance requires cleanup 28 | * (references COM objects, DOM nodes, or other disposable objects), it should 29 | * implement this interface (it may subclass goog.Disposable). 30 | * @record 31 | */ 32 | goog.disposable.IDisposable = function() {}; 33 | 34 | 35 | /** 36 | * Disposes of the object and its resources. 37 | * @return {void} Nothing. 38 | */ 39 | goog.disposable.IDisposable.prototype.dispose = goog.abstractMethod; 40 | 41 | 42 | /** 43 | * @return {boolean} Whether the object has been disposed of. 44 | */ 45 | goog.disposable.IDisposable.prototype.isDisposed = goog.abstractMethod; 46 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/dom/nodetype.js: -------------------------------------------------------------------------------- 1 | // Copyright 2006 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Definition of goog.dom.NodeType. 17 | */ 18 | 19 | goog.provide('goog.dom.NodeType'); 20 | 21 | 22 | /** 23 | * Constants for the nodeType attribute in the Node interface. 24 | * 25 | * These constants match those specified in the Node interface. These are 26 | * usually present on the Node object in recent browsers, but not in older 27 | * browsers (specifically, early IEs) and thus are given here. 28 | * 29 | * In some browsers (early IEs), these are not defined on the Node object, 30 | * so they are provided here. 31 | * 32 | * See http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247 33 | * @enum {number} 34 | */ 35 | goog.dom.NodeType = { 36 | ELEMENT: 1, 37 | ATTRIBUTE: 2, 38 | TEXT: 3, 39 | CDATA_SECTION: 4, 40 | ENTITY_REFERENCE: 5, 41 | ENTITY: 6, 42 | PROCESSING_INSTRUCTION: 7, 43 | COMMENT: 8, 44 | DOCUMENT: 9, 45 | DOCUMENT_TYPE: 10, 46 | DOCUMENT_FRAGMENT: 11, 47 | NOTATION: 12 48 | }; 49 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/events/browserfeature.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Browser capability checks for the events package. 17 | * 18 | */ 19 | 20 | 21 | goog.provide('goog.events.BrowserFeature'); 22 | 23 | goog.require('goog.userAgent'); 24 | 25 | 26 | /** 27 | * Enum of browser capabilities. 28 | * @enum {boolean} 29 | */ 30 | goog.events.BrowserFeature = { 31 | /** 32 | * Whether the button attribute of the event is W3C compliant. False in 33 | * Internet Explorer prior to version 9; document-version dependent. 34 | */ 35 | HAS_W3C_BUTTON: 36 | !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9), 37 | 38 | /** 39 | * Whether the browser supports full W3C event model. 40 | */ 41 | HAS_W3C_EVENT_SUPPORT: 42 | !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9), 43 | 44 | /** 45 | * To prevent default in IE7-8 for certain keydown events we need set the 46 | * keyCode to -1. 47 | */ 48 | SET_KEY_CODE_TO_PREVENT_DEFAULT: 49 | goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9'), 50 | 51 | /** 52 | * Whether the {@code navigator.onLine} property is supported. 53 | */ 54 | HAS_NAVIGATOR_ONLINE_PROPERTY: 55 | !goog.userAgent.WEBKIT || goog.userAgent.isVersionOrHigher('528'), 56 | 57 | /** 58 | * Whether HTML5 network online/offline events are supported. 59 | */ 60 | HAS_HTML5_NETWORK_EVENT_SUPPORT: 61 | goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher('1.9b') || 62 | goog.userAgent.IE && goog.userAgent.isVersionOrHigher('8') || 63 | goog.userAgent.OPERA && goog.userAgent.isVersionOrHigher('9.5') || 64 | goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher('528'), 65 | 66 | /** 67 | * Whether HTML5 network events fire on document.body, or otherwise the 68 | * window. 69 | */ 70 | HTML5_NETWORK_EVENTS_FIRE_ON_BODY: 71 | goog.userAgent.GECKO && !goog.userAgent.isVersionOrHigher('8') || 72 | goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9'), 73 | 74 | /** 75 | * Whether touch is enabled in the browser. 76 | */ 77 | TOUCH_ENABLED: 78 | ('ontouchstart' in goog.global || 79 | !!(goog.global['document'] && document.documentElement && 80 | 'ontouchstart' in document.documentElement) || 81 | // IE10 uses non-standard touch events, so it has a different check. 82 | !!(goog.global['navigator'] && 83 | goog.global['navigator']['msMaxTouchPoints'])) 84 | }; 85 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/events/event.js: -------------------------------------------------------------------------------- 1 | // Copyright 2005 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview A base class for event objects. 17 | * 18 | */ 19 | 20 | 21 | goog.provide('goog.events.Event'); 22 | goog.provide('goog.events.EventLike'); 23 | 24 | /** 25 | * goog.events.Event no longer depends on goog.Disposable. Keep requiring 26 | * goog.Disposable here to not break projects which assume this dependency. 27 | * @suppress {extraRequire} 28 | */ 29 | goog.require('goog.Disposable'); 30 | goog.require('goog.events.EventId'); 31 | 32 | 33 | /** 34 | * A typedef for event like objects that are dispatchable via the 35 | * goog.events.dispatchEvent function. strings are treated as the type for a 36 | * goog.events.Event. Objects are treated as an extension of a new 37 | * goog.events.Event with the type property of the object being used as the type 38 | * of the Event. 39 | * @typedef {string|Object|goog.events.Event|goog.events.EventId} 40 | */ 41 | goog.events.EventLike; 42 | 43 | 44 | 45 | /** 46 | * A base class for event objects, so that they can support preventDefault and 47 | * stopPropagation. 48 | * 49 | * @suppress {underscore} Several properties on this class are technically 50 | * public, but referencing these properties outside this package is strongly 51 | * discouraged. 52 | * 53 | * @param {string|!goog.events.EventId} type Event Type. 54 | * @param {Object=} opt_target Reference to the object that is the target of 55 | * this event. It has to implement the {@code EventTarget} interface 56 | * declared at {@link http://developer.mozilla.org/en/DOM/EventTarget}. 57 | * @constructor 58 | */ 59 | goog.events.Event = function(type, opt_target) { 60 | /** 61 | * Event type. 62 | * @type {string} 63 | */ 64 | this.type = type instanceof goog.events.EventId ? String(type) : type; 65 | 66 | /** 67 | * TODO(tbreisacher): The type should probably be 68 | * EventTarget|goog.events.EventTarget. 69 | * 70 | * Target of the event. 71 | * @type {Object|undefined} 72 | */ 73 | this.target = opt_target; 74 | 75 | /** 76 | * Object that had the listener attached. 77 | * @type {Object|undefined} 78 | */ 79 | this.currentTarget = this.target; 80 | 81 | /** 82 | * Whether to cancel the event in internal capture/bubble processing for IE. 83 | * @type {boolean} 84 | * @public 85 | */ 86 | this.propagationStopped_ = false; 87 | 88 | /** 89 | * Whether the default action has been prevented. 90 | * This is a property to match the W3C specification at 91 | * {@link http://www.w3.org/TR/DOM-Level-3-Events/ 92 | * #events-event-type-defaultPrevented}. 93 | * Must be treated as read-only outside the class. 94 | * @type {boolean} 95 | */ 96 | this.defaultPrevented = false; 97 | 98 | /** 99 | * Return value for in internal capture/bubble processing for IE. 100 | * @type {boolean} 101 | * @public 102 | */ 103 | this.returnValue_ = true; 104 | }; 105 | 106 | 107 | /** 108 | * Stops event propagation. 109 | */ 110 | goog.events.Event.prototype.stopPropagation = function() { 111 | this.propagationStopped_ = true; 112 | }; 113 | 114 | 115 | /** 116 | * Prevents the default action, for example a link redirecting to a url. 117 | */ 118 | goog.events.Event.prototype.preventDefault = function() { 119 | this.defaultPrevented = true; 120 | this.returnValue_ = false; 121 | }; 122 | 123 | 124 | /** 125 | * Stops the propagation of the event. It is equivalent to 126 | * {@code e.stopPropagation()}, but can be used as the callback argument of 127 | * {@link goog.events.listen} without declaring another function. 128 | * @param {!goog.events.Event} e An event. 129 | */ 130 | goog.events.Event.stopPropagation = function(e) { 131 | e.stopPropagation(); 132 | }; 133 | 134 | 135 | /** 136 | * Prevents the default action. It is equivalent to 137 | * {@code e.preventDefault()}, but can be used as the callback argument of 138 | * {@link goog.events.listen} without declaring another function. 139 | * @param {!goog.events.Event} e An event. 140 | */ 141 | goog.events.Event.preventDefault = function(e) { 142 | e.preventDefault(); 143 | }; 144 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/events/eventid.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | goog.provide('goog.events.EventId'); 16 | 17 | 18 | 19 | /** 20 | * A templated class that is used when registering for events. Typical usage: 21 | * 22 | * /** @type {goog.events.EventId} *\ 23 | * var myEventId = new goog.events.EventId( 24 | * goog.events.getUniqueId(('someEvent')); 25 | * 26 | * // No need to cast or declare here since the compiler knows the 27 | * // correct type of 'evt' (MyEventObj). 28 | * something.listen(myEventId, function(evt) {}); 29 | * 30 | * @param {string} eventId 31 | * @template T 32 | * @constructor 33 | * @struct 34 | * @final 35 | */ 36 | goog.events.EventId = function(eventId) { 37 | /** @const */ this.id = eventId; 38 | }; 39 | 40 | 41 | /** 42 | * @override 43 | */ 44 | goog.events.EventId.prototype.toString = function() { 45 | return this.id; 46 | }; 47 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/events/eventtype.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Event Types. 17 | * 18 | * @author arv@google.com (Erik Arvidsson) 19 | */ 20 | 21 | 22 | goog.provide('goog.events.EventType'); 23 | 24 | goog.require('goog.userAgent'); 25 | 26 | 27 | /** 28 | * Returns a prefixed event name for the current browser. 29 | * @param {string} eventName The name of the event. 30 | * @return {string} The prefixed event name. 31 | * @suppress {missingRequire|missingProvide} 32 | * @private 33 | */ 34 | goog.events.getVendorPrefixedName_ = function(eventName) { 35 | return goog.userAgent.WEBKIT ? 36 | 'webkit' + eventName : 37 | (goog.userAgent.OPERA ? 'o' + eventName.toLowerCase() : 38 | eventName.toLowerCase()); 39 | }; 40 | 41 | 42 | /** 43 | * Constants for event names. 44 | * @enum {string} 45 | */ 46 | goog.events.EventType = { 47 | // Mouse events 48 | CLICK: 'click', 49 | RIGHTCLICK: 'rightclick', 50 | DBLCLICK: 'dblclick', 51 | MOUSEDOWN: 'mousedown', 52 | MOUSEUP: 'mouseup', 53 | MOUSEOVER: 'mouseover', 54 | MOUSEOUT: 'mouseout', 55 | MOUSEMOVE: 'mousemove', 56 | MOUSEENTER: 'mouseenter', 57 | MOUSELEAVE: 'mouseleave', 58 | 59 | // Selection events. 60 | // https://www.w3.org/TR/selection-api/ 61 | SELECTIONCHANGE: 'selectionchange', 62 | SELECTSTART: 'selectstart', // IE, Safari, Chrome 63 | 64 | // Wheel events 65 | // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents 66 | WHEEL: 'wheel', 67 | 68 | // Key events 69 | KEYPRESS: 'keypress', 70 | KEYDOWN: 'keydown', 71 | KEYUP: 'keyup', 72 | 73 | // Focus 74 | BLUR: 'blur', 75 | FOCUS: 'focus', 76 | DEACTIVATE: 'deactivate', // IE only 77 | // NOTE: The following two events are not stable in cross-browser usage. 78 | // WebKit and Opera implement DOMFocusIn/Out. 79 | // IE implements focusin/out. 80 | // Gecko implements neither see bug at 81 | // https://bugzilla.mozilla.org/show_bug.cgi?id=396927. 82 | // The DOM Events Level 3 Draft deprecates DOMFocusIn in favor of focusin: 83 | // http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html 84 | // You can use FOCUS in Capture phase until implementations converge. 85 | FOCUSIN: goog.userAgent.IE ? 'focusin' : 'DOMFocusIn', 86 | FOCUSOUT: goog.userAgent.IE ? 'focusout' : 'DOMFocusOut', 87 | 88 | // Forms 89 | CHANGE: 'change', 90 | RESET: 'reset', 91 | SELECT: 'select', 92 | SUBMIT: 'submit', 93 | INPUT: 'input', 94 | PROPERTYCHANGE: 'propertychange', // IE only 95 | 96 | // Drag and drop 97 | DRAGSTART: 'dragstart', 98 | DRAG: 'drag', 99 | DRAGENTER: 'dragenter', 100 | DRAGOVER: 'dragover', 101 | DRAGLEAVE: 'dragleave', 102 | DROP: 'drop', 103 | DRAGEND: 'dragend', 104 | 105 | // Touch events 106 | // Note that other touch events exist, but we should follow the W3C list here. 107 | // http://www.w3.org/TR/touch-events/#list-of-touchevent-types 108 | TOUCHSTART: 'touchstart', 109 | TOUCHMOVE: 'touchmove', 110 | TOUCHEND: 'touchend', 111 | TOUCHCANCEL: 'touchcancel', 112 | 113 | // Misc 114 | BEFOREUNLOAD: 'beforeunload', 115 | CONSOLEMESSAGE: 'consolemessage', 116 | CONTEXTMENU: 'contextmenu', 117 | DEVICEMOTION: 'devicemotion', 118 | DEVICEORIENTATION: 'deviceorientation', 119 | DOMCONTENTLOADED: 'DOMContentLoaded', 120 | ERROR: 'error', 121 | HELP: 'help', 122 | LOAD: 'load', 123 | LOSECAPTURE: 'losecapture', 124 | ORIENTATIONCHANGE: 'orientationchange', 125 | READYSTATECHANGE: 'readystatechange', 126 | RESIZE: 'resize', 127 | SCROLL: 'scroll', 128 | UNLOAD: 'unload', 129 | 130 | // Media events 131 | CANPLAY: 'canplay', 132 | CANPLAYTHROUGH: 'canplaythrough', 133 | DURATIONCHANGE: 'durationchange', 134 | EMPTIED: 'emptied', 135 | ENDED: 'ended', 136 | LOADEDDATA: 'loadeddata', 137 | LOADEDMETADATA: 'loadedmetadata', 138 | PAUSE: 'pause', 139 | PLAY: 'play', 140 | PLAYING: 'playing', 141 | RATECHANGE: 'ratechange', 142 | SEEKED: 'seeked', 143 | SEEKING: 'seeking', 144 | STALLED: 'stalled', 145 | SUSPEND: 'suspend', 146 | TIMEUPDATE: 'timeupdate', 147 | VOLUMECHANGE: 'volumechange', 148 | WAITING: 'waiting', 149 | 150 | // Media Source Extensions events 151 | // https://www.w3.org/TR/media-source/#mediasource-events 152 | SOURCEOPEN: 'sourceopen', 153 | SOURCEENDED: 'sourceended', 154 | SOURCECLOSED: 'sourceclosed', 155 | // https://www.w3.org/TR/media-source/#sourcebuffer-events 156 | ABORT: 'abort', 157 | UPDATE: 'update', 158 | UPDATESTART: 'updatestart', 159 | UPDATEEND: 'updateend', 160 | 161 | // HTML 5 History events 162 | // See http://www.w3.org/TR/html5/browsers.html#event-definitions-0 163 | HASHCHANGE: 'hashchange', 164 | PAGEHIDE: 'pagehide', 165 | PAGESHOW: 'pageshow', 166 | POPSTATE: 'popstate', 167 | 168 | // Copy and Paste 169 | // Support is limited. Make sure it works on your favorite browser 170 | // before using. 171 | // http://www.quirksmode.org/dom/events/cutcopypaste.html 172 | COPY: 'copy', 173 | PASTE: 'paste', 174 | CUT: 'cut', 175 | BEFORECOPY: 'beforecopy', 176 | BEFORECUT: 'beforecut', 177 | BEFOREPASTE: 'beforepaste', 178 | 179 | // HTML5 online/offline events. 180 | // http://www.w3.org/TR/offline-webapps/#related 181 | ONLINE: 'online', 182 | OFFLINE: 'offline', 183 | 184 | // HTML 5 worker events 185 | MESSAGE: 'message', 186 | CONNECT: 'connect', 187 | 188 | // CSS animation events. 189 | /** @suppress {missingRequire} */ 190 | ANIMATIONSTART: goog.events.getVendorPrefixedName_('AnimationStart'), 191 | /** @suppress {missingRequire} */ 192 | ANIMATIONEND: goog.events.getVendorPrefixedName_('AnimationEnd'), 193 | /** @suppress {missingRequire} */ 194 | ANIMATIONITERATION: goog.events.getVendorPrefixedName_('AnimationIteration'), 195 | 196 | // CSS transition events. Based on the browser support described at: 197 | // https://developer.mozilla.org/en/css/css_transitions#Browser_compatibility 198 | /** @suppress {missingRequire} */ 199 | TRANSITIONEND: goog.events.getVendorPrefixedName_('TransitionEnd'), 200 | 201 | // W3C Pointer Events 202 | // http://www.w3.org/TR/pointerevents/ 203 | POINTERDOWN: 'pointerdown', 204 | POINTERUP: 'pointerup', 205 | POINTERCANCEL: 'pointercancel', 206 | POINTERMOVE: 'pointermove', 207 | POINTEROVER: 'pointerover', 208 | POINTEROUT: 'pointerout', 209 | POINTERENTER: 'pointerenter', 210 | POINTERLEAVE: 'pointerleave', 211 | GOTPOINTERCAPTURE: 'gotpointercapture', 212 | LOSTPOINTERCAPTURE: 'lostpointercapture', 213 | 214 | // IE specific events. 215 | // See http://msdn.microsoft.com/en-us/library/ie/hh772103(v=vs.85).aspx 216 | // Note: these events will be supplanted in IE11. 217 | MSGESTURECHANGE: 'MSGestureChange', 218 | MSGESTUREEND: 'MSGestureEnd', 219 | MSGESTUREHOLD: 'MSGestureHold', 220 | MSGESTURESTART: 'MSGestureStart', 221 | MSGESTURETAP: 'MSGestureTap', 222 | MSGOTPOINTERCAPTURE: 'MSGotPointerCapture', 223 | MSINERTIASTART: 'MSInertiaStart', 224 | MSLOSTPOINTERCAPTURE: 'MSLostPointerCapture', 225 | MSPOINTERCANCEL: 'MSPointerCancel', 226 | MSPOINTERDOWN: 'MSPointerDown', 227 | MSPOINTERENTER: 'MSPointerEnter', 228 | MSPOINTERHOVER: 'MSPointerHover', 229 | MSPOINTERLEAVE: 'MSPointerLeave', 230 | MSPOINTERMOVE: 'MSPointerMove', 231 | MSPOINTEROUT: 'MSPointerOut', 232 | MSPOINTEROVER: 'MSPointerOver', 233 | MSPOINTERUP: 'MSPointerUp', 234 | 235 | // Native IMEs/input tools events. 236 | TEXT: 'text', 237 | // The textInput event is supported in IE9+, but only in lower case. All other 238 | // browsers use the camel-case event name. 239 | TEXTINPUT: goog.userAgent.IE ? 'textinput' : 'textInput', 240 | COMPOSITIONSTART: 'compositionstart', 241 | COMPOSITIONUPDATE: 'compositionupdate', 242 | COMPOSITIONEND: 'compositionend', 243 | 244 | // The beforeinput event is initially only supported in Safari. See 245 | // https://bugs.chromium.org/p/chromium/issues/detail?id=342670 for Chrome 246 | // implementation tracking. 247 | BEFOREINPUT: 'beforeinput', 248 | 249 | // Webview tag events 250 | // See http://developer.chrome.com/dev/apps/webview_tag.html 251 | EXIT: 'exit', 252 | LOADABORT: 'loadabort', 253 | LOADCOMMIT: 'loadcommit', 254 | LOADREDIRECT: 'loadredirect', 255 | LOADSTART: 'loadstart', 256 | LOADSTOP: 'loadstop', 257 | RESPONSIVE: 'responsive', 258 | SIZECHANGED: 'sizechanged', 259 | UNRESPONSIVE: 'unresponsive', 260 | 261 | // HTML5 Page Visibility API. See details at 262 | // {@code goog.labs.dom.PageVisibilityMonitor}. 263 | VISIBILITYCHANGE: 'visibilitychange', 264 | 265 | // LocalStorage event. 266 | STORAGE: 'storage', 267 | 268 | // DOM Level 2 mutation events (deprecated). 269 | DOMSUBTREEMODIFIED: 'DOMSubtreeModified', 270 | DOMNODEINSERTED: 'DOMNodeInserted', 271 | DOMNODEREMOVED: 'DOMNodeRemoved', 272 | DOMNODEREMOVEDFROMDOCUMENT: 'DOMNodeRemovedFromDocument', 273 | DOMNODEINSERTEDINTODOCUMENT: 'DOMNodeInsertedIntoDocument', 274 | DOMATTRMODIFIED: 'DOMAttrModified', 275 | DOMCHARACTERDATAMODIFIED: 'DOMCharacterDataModified', 276 | 277 | // Print events. 278 | BEFOREPRINT: 'beforeprint', 279 | AFTERPRINT: 'afterprint' 280 | }; 281 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/events/listener.js: -------------------------------------------------------------------------------- 1 | // Copyright 2005 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Listener object. 17 | * @see ../demos/events.html 18 | */ 19 | 20 | goog.provide('goog.events.Listener'); 21 | 22 | goog.require('goog.events.ListenableKey'); 23 | 24 | 25 | 26 | /** 27 | * Simple class that stores information about a listener 28 | * @param {function(?):?} listener Callback function. 29 | * @param {Function} proxy Wrapper for the listener that patches the event. 30 | * @param {EventTarget|goog.events.Listenable} src Source object for 31 | * the event. 32 | * @param {string} type Event type. 33 | * @param {boolean} capture Whether in capture or bubble phase. 34 | * @param {Object=} opt_handler Object in whose context to execute the callback. 35 | * @implements {goog.events.ListenableKey} 36 | * @constructor 37 | */ 38 | goog.events.Listener = function( 39 | listener, proxy, src, type, capture, opt_handler) { 40 | if (goog.events.Listener.ENABLE_MONITORING) { 41 | this.creationStack = new Error().stack; 42 | } 43 | 44 | /** @override */ 45 | this.listener = listener; 46 | 47 | /** 48 | * A wrapper over the original listener. This is used solely to 49 | * handle native browser events (it is used to simulate the capture 50 | * phase and to patch the event object). 51 | * @type {Function} 52 | */ 53 | this.proxy = proxy; 54 | 55 | /** 56 | * Object or node that callback is listening to 57 | * @type {EventTarget|goog.events.Listenable} 58 | */ 59 | this.src = src; 60 | 61 | /** 62 | * The event type. 63 | * @const {string} 64 | */ 65 | this.type = type; 66 | 67 | /** 68 | * Whether the listener is being called in the capture or bubble phase 69 | * @const {boolean} 70 | */ 71 | this.capture = !!capture; 72 | 73 | /** 74 | * Optional object whose context to execute the listener in 75 | * @type {Object|undefined} 76 | */ 77 | this.handler = opt_handler; 78 | 79 | /** 80 | * The key of the listener. 81 | * @const {number} 82 | * @override 83 | */ 84 | this.key = goog.events.ListenableKey.reserveKey(); 85 | 86 | /** 87 | * Whether to remove the listener after it has been called. 88 | * @type {boolean} 89 | */ 90 | this.callOnce = false; 91 | 92 | /** 93 | * Whether the listener has been removed. 94 | * @type {boolean} 95 | */ 96 | this.removed = false; 97 | }; 98 | 99 | 100 | /** 101 | * @define {boolean} Whether to enable the monitoring of the 102 | * goog.events.Listener instances. Switching on the monitoring is only 103 | * recommended for debugging because it has a significant impact on 104 | * performance and memory usage. If switched off, the monitoring code 105 | * compiles down to 0 bytes. 106 | */ 107 | goog.define('goog.events.Listener.ENABLE_MONITORING', false); 108 | 109 | 110 | /** 111 | * If monitoring the goog.events.Listener instances is enabled, stores the 112 | * creation stack trace of the Disposable instance. 113 | * @type {string} 114 | */ 115 | goog.events.Listener.prototype.creationStack; 116 | 117 | 118 | /** 119 | * Marks this listener as removed. This also remove references held by 120 | * this listener object (such as listener and event source). 121 | */ 122 | goog.events.Listener.prototype.markAsRemoved = function() { 123 | this.removed = true; 124 | this.listener = null; 125 | this.proxy = null; 126 | this.src = null; 127 | this.handler = null; 128 | }; 129 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/labs/useragent/engine.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Closure user agent detection. 17 | * @see http://en.wikipedia.org/wiki/User_agent 18 | * For more information on browser brand, platform, or device see the other 19 | * sub-namespaces in goog.labs.userAgent (browser, platform, and device). 20 | * 21 | */ 22 | 23 | goog.provide('goog.labs.userAgent.engine'); 24 | 25 | goog.require('goog.array'); 26 | goog.require('goog.labs.userAgent.util'); 27 | goog.require('goog.string'); 28 | 29 | 30 | /** 31 | * @return {boolean} Whether the rendering engine is Presto. 32 | */ 33 | goog.labs.userAgent.engine.isPresto = function() { 34 | return goog.labs.userAgent.util.matchUserAgent('Presto'); 35 | }; 36 | 37 | 38 | /** 39 | * @return {boolean} Whether the rendering engine is Trident. 40 | */ 41 | goog.labs.userAgent.engine.isTrident = function() { 42 | // IE only started including the Trident token in IE8. 43 | return goog.labs.userAgent.util.matchUserAgent('Trident') || 44 | goog.labs.userAgent.util.matchUserAgent('MSIE'); 45 | }; 46 | 47 | 48 | /** 49 | * @return {boolean} Whether the rendering engine is Edge. 50 | */ 51 | goog.labs.userAgent.engine.isEdge = function() { 52 | return goog.labs.userAgent.util.matchUserAgent('Edge'); 53 | }; 54 | 55 | 56 | /** 57 | * @return {boolean} Whether the rendering engine is WebKit. 58 | */ 59 | goog.labs.userAgent.engine.isWebKit = function() { 60 | return goog.labs.userAgent.util.matchUserAgentIgnoreCase('WebKit') && 61 | !goog.labs.userAgent.engine.isEdge(); 62 | }; 63 | 64 | 65 | /** 66 | * @return {boolean} Whether the rendering engine is Gecko. 67 | */ 68 | goog.labs.userAgent.engine.isGecko = function() { 69 | return goog.labs.userAgent.util.matchUserAgent('Gecko') && 70 | !goog.labs.userAgent.engine.isWebKit() && 71 | !goog.labs.userAgent.engine.isTrident() && 72 | !goog.labs.userAgent.engine.isEdge(); 73 | }; 74 | 75 | 76 | /** 77 | * @return {string} The rendering engine's version or empty string if version 78 | * can't be determined. 79 | */ 80 | goog.labs.userAgent.engine.getVersion = function() { 81 | var userAgentString = goog.labs.userAgent.util.getUserAgent(); 82 | if (userAgentString) { 83 | var tuples = goog.labs.userAgent.util.extractVersionTuples(userAgentString); 84 | 85 | var engineTuple = goog.labs.userAgent.engine.getEngineTuple_(tuples); 86 | if (engineTuple) { 87 | // In Gecko, the version string is either in the browser info or the 88 | // Firefox version. See Gecko user agent string reference: 89 | // http://goo.gl/mULqa 90 | if (engineTuple[0] == 'Gecko') { 91 | return goog.labs.userAgent.engine.getVersionForKey_(tuples, 'Firefox'); 92 | } 93 | 94 | return engineTuple[1]; 95 | } 96 | 97 | // MSIE has only one version identifier, and the Trident version is 98 | // specified in the parenthetical. IE Edge is covered in the engine tuple 99 | // detection. 100 | var browserTuple = tuples[0]; 101 | var info; 102 | if (browserTuple && (info = browserTuple[2])) { 103 | var match = /Trident\/([^\s;]+)/.exec(info); 104 | if (match) { 105 | return match[1]; 106 | } 107 | } 108 | } 109 | return ''; 110 | }; 111 | 112 | 113 | /** 114 | * @param {!Array>} tuples Extracted version tuples. 115 | * @return {!Array|undefined} The engine tuple or undefined if not 116 | * found. 117 | * @private 118 | */ 119 | goog.labs.userAgent.engine.getEngineTuple_ = function(tuples) { 120 | if (!goog.labs.userAgent.engine.isEdge()) { 121 | return tuples[1]; 122 | } 123 | for (var i = 0; i < tuples.length; i++) { 124 | var tuple = tuples[i]; 125 | if (tuple[0] == 'Edge') { 126 | return tuple; 127 | } 128 | } 129 | }; 130 | 131 | 132 | /** 133 | * @param {string|number} version The version to check. 134 | * @return {boolean} Whether the rendering engine version is higher or the same 135 | * as the given version. 136 | */ 137 | goog.labs.userAgent.engine.isVersionOrHigher = function(version) { 138 | return goog.string.compareVersions( 139 | goog.labs.userAgent.engine.getVersion(), version) >= 0; 140 | }; 141 | 142 | 143 | /** 144 | * @param {!Array>} tuples Version tuples. 145 | * @param {string} key The key to look for. 146 | * @return {string} The version string of the given key, if present. 147 | * Otherwise, the empty string. 148 | * @private 149 | */ 150 | goog.labs.userAgent.engine.getVersionForKey_ = function(tuples, key) { 151 | // TODO(nnaze): Move to util if useful elsewhere. 152 | 153 | var pair = goog.array.find(tuples, function(pair) { return key == pair[0]; }); 154 | 155 | return pair && pair[1] || ''; 156 | }; 157 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/labs/useragent/platform.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Closure user agent platform detection. 17 | * @see User agent strings 18 | * For more information on browser brand, rendering engine, or device see the 19 | * other sub-namespaces in goog.labs.userAgent (browser, engine, and device 20 | * respectively). 21 | * 22 | */ 23 | 24 | goog.provide('goog.labs.userAgent.platform'); 25 | 26 | goog.require('goog.labs.userAgent.util'); 27 | goog.require('goog.string'); 28 | 29 | 30 | /** 31 | * @return {boolean} Whether the platform is Android. 32 | */ 33 | goog.labs.userAgent.platform.isAndroid = function() { 34 | return goog.labs.userAgent.util.matchUserAgent('Android'); 35 | }; 36 | 37 | 38 | /** 39 | * @return {boolean} Whether the platform is iPod. 40 | */ 41 | goog.labs.userAgent.platform.isIpod = function() { 42 | return goog.labs.userAgent.util.matchUserAgent('iPod'); 43 | }; 44 | 45 | 46 | /** 47 | * @return {boolean} Whether the platform is iPhone. 48 | */ 49 | goog.labs.userAgent.platform.isIphone = function() { 50 | return goog.labs.userAgent.util.matchUserAgent('iPhone') && 51 | !goog.labs.userAgent.util.matchUserAgent('iPod') && 52 | !goog.labs.userAgent.util.matchUserAgent('iPad'); 53 | }; 54 | 55 | 56 | /** 57 | * @return {boolean} Whether the platform is iPad. 58 | */ 59 | goog.labs.userAgent.platform.isIpad = function() { 60 | return goog.labs.userAgent.util.matchUserAgent('iPad'); 61 | }; 62 | 63 | 64 | /** 65 | * @return {boolean} Whether the platform is iOS. 66 | */ 67 | goog.labs.userAgent.platform.isIos = function() { 68 | return goog.labs.userAgent.platform.isIphone() || 69 | goog.labs.userAgent.platform.isIpad() || 70 | goog.labs.userAgent.platform.isIpod(); 71 | }; 72 | 73 | 74 | /** 75 | * @return {boolean} Whether the platform is Mac. 76 | */ 77 | goog.labs.userAgent.platform.isMacintosh = function() { 78 | return goog.labs.userAgent.util.matchUserAgent('Macintosh'); 79 | }; 80 | 81 | 82 | /** 83 | * Note: ChromeOS is not considered to be Linux as it does not report itself 84 | * as Linux in the user agent string. 85 | * @return {boolean} Whether the platform is Linux. 86 | */ 87 | goog.labs.userAgent.platform.isLinux = function() { 88 | return goog.labs.userAgent.util.matchUserAgent('Linux'); 89 | }; 90 | 91 | 92 | /** 93 | * @return {boolean} Whether the platform is Windows. 94 | */ 95 | goog.labs.userAgent.platform.isWindows = function() { 96 | return goog.labs.userAgent.util.matchUserAgent('Windows'); 97 | }; 98 | 99 | 100 | /** 101 | * @return {boolean} Whether the platform is ChromeOS. 102 | */ 103 | goog.labs.userAgent.platform.isChromeOS = function() { 104 | return goog.labs.userAgent.util.matchUserAgent('CrOS'); 105 | }; 106 | 107 | 108 | /** 109 | * The version of the platform. We only determine the version for Windows, 110 | * Mac, and Chrome OS. It doesn't make much sense on Linux. For Windows, we only 111 | * look at the NT version. Non-NT-based versions (e.g. 95, 98, etc.) are given 112 | * version 0.0. 113 | * 114 | * @return {string} The platform version or empty string if version cannot be 115 | * determined. 116 | */ 117 | goog.labs.userAgent.platform.getVersion = function() { 118 | var userAgentString = goog.labs.userAgent.util.getUserAgent(); 119 | var version = '', re; 120 | if (goog.labs.userAgent.platform.isWindows()) { 121 | re = /Windows (?:NT|Phone) ([0-9.]+)/; 122 | var match = re.exec(userAgentString); 123 | if (match) { 124 | version = match[1]; 125 | } else { 126 | version = '0.0'; 127 | } 128 | } else if (goog.labs.userAgent.platform.isIos()) { 129 | re = /(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/; 130 | var match = re.exec(userAgentString); 131 | // Report the version as x.y.z and not x_y_z 132 | version = match && match[1].replace(/_/g, '.'); 133 | } else if (goog.labs.userAgent.platform.isMacintosh()) { 134 | re = /Mac OS X ([0-9_.]+)/; 135 | var match = re.exec(userAgentString); 136 | // Note: some old versions of Camino do not report an OSX version. 137 | // Default to 10. 138 | version = match ? match[1].replace(/_/g, '.') : '10'; 139 | } else if (goog.labs.userAgent.platform.isAndroid()) { 140 | re = /Android\s+([^\);]+)(\)|;)/; 141 | var match = re.exec(userAgentString); 142 | version = match && match[1]; 143 | } else if (goog.labs.userAgent.platform.isChromeOS()) { 144 | re = /(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/; 145 | var match = re.exec(userAgentString); 146 | version = match && match[1]; 147 | } 148 | return version || ''; 149 | }; 150 | 151 | 152 | /** 153 | * @param {string|number} version The version to check. 154 | * @return {boolean} Whether the browser version is higher or the same as the 155 | * given version. 156 | */ 157 | goog.labs.userAgent.platform.isVersionOrHigher = function(version) { 158 | return goog.string.compareVersions( 159 | goog.labs.userAgent.platform.getVersion(), version) >= 0; 160 | }; 161 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/labs/useragent/util.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Utilities used by goog.labs.userAgent tools. These functions 17 | * should not be used outside of goog.labs.userAgent.*. 18 | * 19 | * 20 | * @author nnaze@google.com (Nathan Naze) 21 | */ 22 | 23 | goog.provide('goog.labs.userAgent.util'); 24 | 25 | goog.require('goog.string'); 26 | 27 | 28 | /** 29 | * Gets the native userAgent string from navigator if it exists. 30 | * If navigator or navigator.userAgent string is missing, returns an empty 31 | * string. 32 | * @return {string} 33 | * @private 34 | */ 35 | goog.labs.userAgent.util.getNativeUserAgentString_ = function() { 36 | var navigator = goog.labs.userAgent.util.getNavigator_(); 37 | if (navigator) { 38 | var userAgent = navigator.userAgent; 39 | if (userAgent) { 40 | return userAgent; 41 | } 42 | } 43 | return ''; 44 | }; 45 | 46 | 47 | /** 48 | * Getter for the native navigator. 49 | * This is a separate function so it can be stubbed out in testing. 50 | * @return {Navigator} 51 | * @private 52 | */ 53 | goog.labs.userAgent.util.getNavigator_ = function() { 54 | return goog.global.navigator; 55 | }; 56 | 57 | 58 | /** 59 | * A possible override for applications which wish to not check 60 | * navigator.userAgent but use a specified value for detection instead. 61 | * @private {string} 62 | */ 63 | goog.labs.userAgent.util.userAgent_ = 64 | goog.labs.userAgent.util.getNativeUserAgentString_(); 65 | 66 | 67 | /** 68 | * Applications may override browser detection on the built in 69 | * navigator.userAgent object by setting this string. Set to null to use the 70 | * browser object instead. 71 | * @param {?string=} opt_userAgent The User-Agent override. 72 | */ 73 | goog.labs.userAgent.util.setUserAgent = function(opt_userAgent) { 74 | goog.labs.userAgent.util.userAgent_ = 75 | opt_userAgent || goog.labs.userAgent.util.getNativeUserAgentString_(); 76 | }; 77 | 78 | 79 | /** 80 | * @return {string} The user agent string. 81 | */ 82 | goog.labs.userAgent.util.getUserAgent = function() { 83 | return goog.labs.userAgent.util.userAgent_; 84 | }; 85 | 86 | 87 | /** 88 | * @param {string} str 89 | * @return {boolean} Whether the user agent contains the given string. 90 | */ 91 | goog.labs.userAgent.util.matchUserAgent = function(str) { 92 | var userAgent = goog.labs.userAgent.util.getUserAgent(); 93 | return goog.string.contains(userAgent, str); 94 | }; 95 | 96 | 97 | /** 98 | * @param {string} str 99 | * @return {boolean} Whether the user agent contains the given string, ignoring 100 | * case. 101 | */ 102 | goog.labs.userAgent.util.matchUserAgentIgnoreCase = function(str) { 103 | var userAgent = goog.labs.userAgent.util.getUserAgent(); 104 | return goog.string.caseInsensitiveContains(userAgent, str); 105 | }; 106 | 107 | 108 | /** 109 | * Parses the user agent into tuples for each section. 110 | * @param {string} userAgent 111 | * @return {!Array>} Tuples of key, version, and the contents 112 | * of the parenthetical. 113 | */ 114 | goog.labs.userAgent.util.extractVersionTuples = function(userAgent) { 115 | // Matches each section of a user agent string. 116 | // Example UA: 117 | // Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) 118 | // AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405 119 | // This has three version tuples: Mozilla, AppleWebKit, and Mobile. 120 | 121 | var versionRegExp = new RegExp( 122 | // Key. Note that a key may have a space. 123 | // (i.e. 'Mobile Safari' in 'Mobile Safari/5.0') 124 | '(\\w[\\w ]+)' + 125 | 126 | '/' + // slash 127 | '([^\\s]+)' + // version (i.e. '5.0b') 128 | '\\s*' + // whitespace 129 | '(?:\\((.*?)\\))?', // parenthetical info. parentheses not matched. 130 | 'g'); 131 | 132 | var data = []; 133 | var match; 134 | 135 | // Iterate and collect the version tuples. Each iteration will be the 136 | // next regex match. 137 | while (match = versionRegExp.exec(userAgent)) { 138 | data.push([ 139 | match[1], // key 140 | match[2], // value 141 | // || undefined as this is not undefined in IE7 and IE8 142 | match[3] || undefined // info 143 | ]); 144 | } 145 | 146 | return data; 147 | }; 148 | -------------------------------------------------------------------------------- /AJC-bin/as-js-wasm/library/closure/goog/reflect/reflect.js: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Useful compiler idioms. 17 | * 18 | * @author johnlenz@google.com (John Lenz) 19 | */ 20 | 21 | goog.provide('goog.reflect'); 22 | 23 | 24 | /** 25 | * Syntax for object literal casts. 26 | * @see http://go/jscompiler-renaming 27 | * @see https://goo.gl/CRs09P 28 | * 29 | * Use this if you have an object literal whose keys need to have the same names 30 | * as the properties of some class even after they are renamed by the compiler. 31 | * 32 | * @param {!Function} type Type to cast to. 33 | * @param {Object} object Object literal to cast. 34 | * @return {Object} The object literal. 35 | */ 36 | goog.reflect.object = function(type, object) { 37 | return object; 38 | }; 39 | 40 | /** 41 | * Syntax for renaming property strings. 42 | * @see http://go/jscompiler-renaming 43 | * @see https://goo.gl/CRs09P 44 | * 45 | * Use this if you have an need to access a property as a string, but want 46 | * to also have the property renamed by the compiler. In contrast to 47 | * goog.reflect.object, this method takes an instance of an object. 48 | * 49 | * Properties must be simple names (not qualified names). 50 | * 51 | * @param {string} prop Name of the property 52 | * @param {!Object} object Instance of the object whose type will be used 53 | * for renaming 54 | * @return {string} The renamed property. 55 | */ 56 | goog.reflect.objectProperty = function(prop, object) { 57 | return prop; 58 | }; 59 | 60 | /** 61 | * To assert to the compiler that an operation is needed when it would 62 | * otherwise be stripped. For example: 63 | * 64 | * // Force a layout 65 | * goog.reflect.sinkValue(dialog.offsetHeight); 66 | * 67 | * @param {T} x 68 | * @return {T} 69 | * @template T 70 | */ 71 | goog.reflect.sinkValue = function(x) { 72 | goog.reflect.sinkValue[' '](x); 73 | return x; 74 | }; 75 | 76 | 77 | /** 78 | * The compiler should optimize this function away iff no one ever uses 79 | * goog.reflect.sinkValue. 80 | */ 81 | goog.reflect.sinkValue[' '] = goog.nullFunction; 82 | 83 | 84 | /** 85 | * Check if a property can be accessed without throwing an exception. 86 | * @param {Object} obj The owner of the property. 87 | * @param {string} prop The property name. 88 | * @return {boolean} Whether the property is accessible. Will also return true 89 | * if obj is null. 90 | */ 91 | goog.reflect.canAccessProperty = function(obj, prop) { 92 | 93 | try { 94 | goog.reflect.sinkValue(obj[prop]); 95 | return true; 96 | } catch (e) { 97 | } 98 | return false; 99 | }; 100 | 101 | 102 | /** 103 | * Retrieves a value from a cache given a key. The compiler provides special 104 | * consideration for this call such that it is generally considered side-effect 105 | * free. However, if the {@code opt_keyFn} or {@code valueFn} have side-effects 106 | * then the entire call is considered to have side-effects. 107 | * 108 | * Conventionally storing the value on the cache would be considered a 109 | * side-effect and preclude unused calls from being pruned, ie. even if 110 | * the value was never used, it would still always be stored in the cache. 111 | * 112 | * Providing a side-effect free {@code valueFn} and {@code opt_keyFn} 113 | * allows unused calls to {@code goog.reflect.cache} to be pruned. 114 | * 115 | * @param {!Object} cacheObj The object that contains the cached values. 116 | * @param {?} key The key to lookup in the cache. If it is not string or number 117 | * then a {@code opt_keyFn} should be provided. The key is also used as the 118 | * parameter to the {@code valueFn}. 119 | * @param {function(?):V} valueFn The value provider to use to calculate the 120 | * value to store in the cache. This function should be side-effect free 121 | * to take advantage of the optimization. 122 | * @param {function(?):K=} opt_keyFn The key provider to determine the cache 123 | * map key. This should be used if the given key is not a string or number. 124 | * If not provided then the given key is used. This function should be 125 | * side-effect free to take advantage of the optimization. 126 | * @return {V} The cached or calculated value. 127 | * @template K 128 | * @template V 129 | */ 130 | goog.reflect.cache = function(cacheObj, key, valueFn, opt_keyFn) { 131 | var storedKey = opt_keyFn ? opt_keyFn(key) : key; 132 | 133 | if (Object.prototype.hasOwnProperty.call(cacheObj, storedKey)) { 134 | return cacheObj[storedKey]; 135 | } 136 | 137 | return (cacheObj[storedKey] = valueFn(key)); 138 | }; 139 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/AjcEmscConsole.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @constructor 4 | */ 5 | AjcEmscConsole = function() { 6 | var /** @type {*} */ _script = document.createElement('script'); 7 | _script.onload = this.initWasm.bind(this); 8 | _script.src = ajcGlobal.emscModuleFileName + ".js"; 9 | _script.defer = false; 10 | _script.async = false; 11 | document.head.appendChild(_script); 12 | }; 13 | 14 | /** 15 | * @private 16 | * @type {XMLHttpRequest} 17 | */ 18 | AjcEmscConsole.prototype.loader; 19 | 20 | 21 | /** 22 | * @private 23 | * @type {*} 24 | */ 25 | AjcEmscConsole.prototype.loadedWasmBytes; 26 | 27 | 28 | 29 | /** 30 | * @private 31 | */ 32 | AjcEmscConsole.prototype.initWasm = function() { 33 | this.loader = new XMLHttpRequest(); 34 | this.loader.open('GET', ajcGlobal.emscModuleFileName + ".wasm", true); 35 | this.loader.responseType = 'arraybuffer'; 36 | this.loader.onload = this.loadCompelteEvent.bind(this); 37 | this.loader.send(); 38 | }; 39 | 40 | 41 | /** 42 | * @private 43 | * @param {Event=} e 44 | */ 45 | AjcEmscConsole.prototype.loadCompelteEvent = function(e) { 46 | console.log("wasm loaded"); 47 | this.loadedWasmBytes = this.loader.response; 48 | 49 | var ajcEmscConfig ={}; 50 | ajcEmscConfig.noInitialRun = true; 51 | ajcEmscConfig.onRuntimeInitialized = this.onRuntimeInitialized.bind(this); 52 | ajcEmscConfig.instantiateWasm = this.wasmInstantiateCallBack.bind(this); 53 | 54 | if(ajcGlobal.hasOwnProperty("emscModuleConfig")) 55 | { 56 | Object.keys(ajcGlobal.emscModuleConfig).forEach 57 | ( 58 | function(key) 59 | { 60 | ajcEmscConfig[key] = ajcGlobal.emscModuleConfig[key]; 61 | } 62 | ) 63 | } 64 | 65 | ajcGlobal.stageInitWidth = ajcGlobal.stageInitWidth || 800; 66 | ajcGlobal.stageInitHeight = ajcGlobal.stageInitHeight || 600; 67 | 68 | var _rootHtmlElement = document.createElement('div'); 69 | _rootHtmlElement.style.left = "0px"; 70 | _rootHtmlElement.style.top = "0px"; 71 | _rootHtmlElement.style.position = ajcGlobal.useStageMinSize ? "absolute" : "fixed"; 72 | _rootHtmlElement.style.width = ajcGlobal.stageInitWidth.toString() + "px"; 73 | _rootHtmlElement.style.height = ajcGlobal.stageInitHeight.toString() + "px"; 74 | ajcGlobal.rootHtmlElementID = _rootHtmlElement.id = 'rootHtmlElement'; 75 | document.body.appendChild(_rootHtmlElement); 76 | 77 | 78 | if(!ajcEmscConfig.hasOwnProperty('canvas')) 79 | { 80 | var canvas = document.createElement('canvas'); 81 | canvas.style.position = "fixed"; 82 | canvas.style.left = "0px"; 83 | canvas.style.top = "0px"; 84 | canvas.id= "canvas"; 85 | _rootHtmlElement.appendChild(canvas); 86 | 87 | ajcEmscConfig.canvas = canvas; 88 | } 89 | 90 | window[ajcGlobal.emscOutputModuleName] = new window[ajcGlobal.emscSrcEmscModuleName](ajcEmscConfig); 91 | }; 92 | 93 | /** 94 | * @private 95 | * @param {*} info 96 | * @param {Function} receiveInstance 97 | * @return {*} 98 | */ 99 | AjcEmscConsole.prototype.wasmInstantiateCallBack = function(info, receiveInstance) { 100 | console.log("wasm-Instantiate-CallBack"); 101 | WebAssembly.instantiate(this.loadedWasmBytes, info).then( 102 | function(output) { 103 | console.log("receiveInstance"); 104 | receiveInstance(output["instance"]); 105 | }); 106 | return {}; 107 | }; 108 | 109 | 110 | /** 111 | * @private 112 | */ 113 | AjcEmscConsole.prototype.onRuntimeInitialized = function() 114 | { 115 | 116 | var moduleObject = window[ajcGlobal.emscOutputModuleName]; 117 | 118 | Object.keys(moduleObject).forEach 119 | ( 120 | function(key) 121 | { 122 | if(key.includes("$")) 123 | { 124 | console.log("exported packged classes: "+key); 125 | 126 | var packageArray = key.split('$'); 127 | var len = packageArray.length -1; 128 | var parentPackge = moduleObject; 129 | for(var i = 0; i < len; i++) 130 | { 131 | if(!parentPackge.hasOwnProperty(packageArray[i])) 132 | parentPackge[packageArray[i]] = {}; 133 | 134 | parentPackge = parentPackge[packageArray[i]]; 135 | 136 | } 137 | parentPackge[packageArray[len]] = moduleObject[key]; 138 | delete moduleObject[key]; 139 | } 140 | } 141 | ) 142 | 143 | moduleObject["_STAGE_INSTANCE_"] = new moduleObject.display.Stage(); 144 | moduleObject["_STAGE_INSTANCE_"].addEventListener("init", this.onStageInit.bind(this)); 145 | 146 | var arrayArgs = []; 147 | arrayArgs.push("-windowWidth",ajcGlobal.stageInitWidth.toString()); 148 | arrayArgs.push("-windowHeight",ajcGlobal.stageInitHeight.toString()); 149 | arrayArgs.push("-windowAutoSize",ajcGlobal.stageAutoSize? "1": "0"); 150 | if(ajcGlobal.emscModuleAdditionalMainArgs) 151 | { 152 | var additionalArgsArray = ajcGlobal.emscModuleAdditionalMainArgs.split(" "); 153 | 154 | Array.prototype.push.apply(arrayArgs,additionalArgsArray); 155 | } 156 | window[ajcGlobal.emscOutputModuleName].callMain(arrayArgs); 157 | }; 158 | 159 | AjcEmscConsole.prototype.onStageInit = function(e) 160 | { 161 | console.log("onStageInit"); 162 | 163 | var moduleObject = window[ajcGlobal.emscOutputModuleName]; 164 | 165 | moduleObject["_STAGE_INSTANCE_"].removeEventListener("init", this.onStageInit.bind(this)); 166 | 167 | 168 | if(ajcGlobal.buildType == 'intermediate') 169 | { 170 | goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = true; 171 | goog.require(ajcGlobal.appRootName); 172 | } 173 | else 174 | { 175 | moduleObject["_STAGE_INSTANCE_"].addChild(new window[ajcGlobal.appRootName]()); 176 | } 177 | 178 | var runDependencyWatcher = setInterval(function() 179 | { 180 | if(window[ajcGlobal.appRootName] !== undefined) 181 | { 182 | clearInterval(runDependencyWatcher); 183 | moduleObject["_STAGE_INSTANCE_"].addChild(new window[ajcGlobal.appRootName]()); 184 | return; 185 | } 186 | }, 100); 187 | 188 | } -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/AjcRuntimeWeb.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/AJC-bin/cpp-wasm/AjcRuntimeWeb.wasm -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/Test_BunnyMark_Native.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Generated by Apache Flex Cross-Compiler from Test_BunnyMark_Native.as 3 | * Test_BunnyMark_Native 4 | * 5 | * @fileoverview 6 | * 7 | * @suppress {checkTypes|accessControls} 8 | */ 9 | 10 | goog.provide('Test_BunnyMark_Native'); 11 | 12 | 13 | 14 | 15 | /** 16 | * @usage this is used for configing emsc module. 17 | * 18 | * 19 | * 32 | * 33 | * @constructor 34 | * @extends {flash.display.Sprite} 35 | */ 36 | Test_BunnyMark_Native = function() { 37 | Test_BunnyMark_Native.base(this, 'constructor'); 38 | var /** @type {*} */ wasmModual = window["flash"]; 39 | wasmModual["RunBunnyTest"](20000); 40 | }; 41 | goog.inherits(Test_BunnyMark_Native, flash.display.Sprite, 'Test_BunnyMark_Native'); 42 | 43 | 44 | /** 45 | * Metadata 46 | * 47 | * @type {Object.>} 48 | */ 49 | Test_BunnyMark_Native.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Test_BunnyMark_Native', qName: 'Test_BunnyMark_Native', kind: 'class' }] }; 50 | 51 | 52 | /** 53 | * Prevent renaming of class. Needed for reflection. 54 | */ 55 | goog.exportSymbol('Test_BunnyMark_Native', Test_BunnyMark_Native); 56 | 57 | 58 | 59 | /** 60 | * Reflection 61 | * 62 | * @return {Object.} 63 | */ 64 | Test_BunnyMark_Native.prototype.FLEXJS_REFLECTION_INFO = function () { 65 | return { 66 | variables: function () {return {};}, 67 | accessors: function () {return {};}, 68 | methods: function () { 69 | return { 70 | 'Test_BunnyMark_Native': { type: '', declaredBy: 'Test_BunnyMark_Native'} 71 | }; 72 | } 73 | }; 74 | }; 75 | 76 | //# sourceMappingURL=./Test_BunnyMark_Native.js.map -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/Test_BunnyMark_Native.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version":3, 3 | "file":"Test_BunnyMark_Native.js", 4 | "lineCount":40, 5 | "mappings":"A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BkB,qBAAhB,WAAqC,CAAC,C,CACtC,C;;EACC,IAAc,iBAAV,UAAY,GAAG,MAAM,CAAC,OAAO,CAAC,C;EAClC,UAAU,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,C;AAClC;", 6 | "sources":["..\\..\\src\\Test_BunnyMark_Native.as"], 7 | "names":[] 8 | } 9 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/assets/skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/AJC-bin/cpp-wasm/assets/skin.png -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 11 | 24 | 25 | 26 | 27 | 32 | 33 | 34 | 37 | 38 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/bootstrap/nodejs.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview A nodejs script for dynamically requiring Closure within 17 | * nodejs. 18 | * 19 | * Example of usage: 20 | * 21 | * require('./bootstrap/nodejs') 22 | * goog.require('goog.ui.Component') 23 | * 24 | * 25 | * This loads goog.ui.Component in the global scope. 26 | * 27 | * If you want to load custom libraries, you can require the custom deps file 28 | * directly. If your custom libraries introduce new globals, you may 29 | * need to run goog.nodeGlobalRequire to get them to load correctly. 30 | * 31 | * 32 | * require('./path/to/my/deps.js') 33 | * goog.bootstrap.nodeJs.nodeGlobalRequire('./path/to/my/base.js') 34 | * goog.require('my.Class') 35 | * 36 | * 37 | * @author nick@medium.com (Nick Santos) 38 | * 39 | * @nocompile 40 | */ 41 | 42 | 43 | var fs = require('fs'); 44 | var path = require('path'); 45 | var vm = require('vm'); 46 | 47 | 48 | /** 49 | * The goog namespace in the global scope. 50 | */ 51 | global.goog = {}; 52 | 53 | 54 | /** 55 | * Imports a script using Node's require() API. 56 | * 57 | * @param {string} src The script source. 58 | * @param {string=} opt_sourceText The optional source text to evaluate. 59 | * @return {boolean} True if the script was imported, false otherwise. 60 | */ 61 | global.CLOSURE_IMPORT_SCRIPT = function(src, opt_sourceText) { 62 | // Sources are always expressed relative to closure's base.js, but 63 | // require() is always relative to the current source. 64 | if (opt_sourceText === undefined) { 65 | require('./../' + src); 66 | } else { 67 | eval(opt_sourceText); 68 | } 69 | return true; 70 | }; 71 | 72 | 73 | /** 74 | * Loads a file when using Closure's goog.require() API with goog.modules. 75 | * 76 | * @param {string} src The file source. 77 | * @return {string} The file contents. 78 | */ 79 | global.CLOSURE_LOAD_FILE_SYNC = function(src) { 80 | return fs.readFileSync( 81 | path.resolve(__dirname, '..', src), {encoding: 'utf-8'}); 82 | }; 83 | 84 | 85 | // Declared here so it can be used to require base.js 86 | function nodeGlobalRequire(file) { 87 | vm.runInThisContext.call(global, fs.readFileSync(file), file); 88 | } 89 | 90 | 91 | // Load Closure's base.js into memory. It is assumed base.js is in the 92 | // directory above this directory given this script's location in 93 | // bootstrap/nodejs.js. 94 | nodeGlobalRequire(path.resolve(__dirname, '..', 'base.js')); 95 | 96 | 97 | /** 98 | * Bootstraps a file into the global scope. 99 | * 100 | * This is strictly for cases where normal require() won't work, 101 | * because the file declares global symbols with 'var' that need to 102 | * be added to the global scope. 103 | * @suppress {missingProvide} 104 | * 105 | * @param {string} file The path to the file. 106 | */ 107 | goog.nodeGlobalRequire = nodeGlobalRequire; 108 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/debug/entrypointregistry.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview A global registry for entry points into a program, 17 | * so that they can be instrumented. Each module should register their 18 | * entry points with this registry. Designed to be compiled out 19 | * if no instrumentation is requested. 20 | * 21 | * Entry points may be registered before or after a call to 22 | * goog.debug.entryPointRegistry.monitorAll. If an entry point is registered 23 | * later, the existing monitor will instrument the new entry point. 24 | * 25 | * @author nicksantos@google.com (Nick Santos) 26 | */ 27 | 28 | goog.provide('goog.debug.EntryPointMonitor'); 29 | goog.provide('goog.debug.entryPointRegistry'); 30 | 31 | goog.require('goog.asserts'); 32 | 33 | 34 | 35 | /** 36 | * @interface 37 | */ 38 | goog.debug.EntryPointMonitor = function() {}; 39 | 40 | 41 | /** 42 | * Instruments a function. 43 | * 44 | * @param {!Function} fn A function to instrument. 45 | * @return {!Function} The instrumented function. 46 | */ 47 | goog.debug.EntryPointMonitor.prototype.wrap; 48 | 49 | 50 | /** 51 | * Try to remove an instrumentation wrapper created by this monitor. 52 | * If the function passed to unwrap is not a wrapper created by this 53 | * monitor, then we will do nothing. 54 | * 55 | * Notice that some wrappers may not be unwrappable. For example, if other 56 | * monitors have applied their own wrappers, then it will be impossible to 57 | * unwrap them because their wrappers will have captured our wrapper. 58 | * 59 | * So it is important that entry points are unwrapped in the reverse 60 | * order that they were wrapped. 61 | * 62 | * @param {!Function} fn A function to unwrap. 63 | * @return {!Function} The unwrapped function, or {@code fn} if it was not 64 | * a wrapped function created by this monitor. 65 | */ 66 | goog.debug.EntryPointMonitor.prototype.unwrap; 67 | 68 | 69 | /** 70 | * An array of entry point callbacks. 71 | * @type {!Array} 72 | * @private 73 | */ 74 | goog.debug.entryPointRegistry.refList_ = []; 75 | 76 | 77 | /** 78 | * Monitors that should wrap all the entry points. 79 | * @type {!Array} 80 | * @private 81 | */ 82 | goog.debug.entryPointRegistry.monitors_ = []; 83 | 84 | 85 | /** 86 | * Whether goog.debug.entryPointRegistry.monitorAll has ever been called. 87 | * Checking this allows the compiler to optimize out the registrations. 88 | * @type {boolean} 89 | * @private 90 | */ 91 | goog.debug.entryPointRegistry.monitorsMayExist_ = false; 92 | 93 | 94 | /** 95 | * Register an entry point with this module. 96 | * 97 | * The entry point will be instrumented when a monitor is passed to 98 | * goog.debug.entryPointRegistry.monitorAll. If this has already occurred, the 99 | * entry point is instrumented immediately. 100 | * 101 | * @param {function(!Function)} callback A callback function which is called 102 | * with a transforming function to instrument the entry point. The callback 103 | * is responsible for wrapping the relevant entry point with the 104 | * transforming function. 105 | */ 106 | goog.debug.entryPointRegistry.register = function(callback) { 107 | // Don't use push(), so that this can be compiled out. 108 | goog.debug.entryPointRegistry 109 | .refList_[goog.debug.entryPointRegistry.refList_.length] = callback; 110 | // If no one calls monitorAll, this can be compiled out. 111 | if (goog.debug.entryPointRegistry.monitorsMayExist_) { 112 | var monitors = goog.debug.entryPointRegistry.monitors_; 113 | for (var i = 0; i < monitors.length; i++) { 114 | callback(goog.bind(monitors[i].wrap, monitors[i])); 115 | } 116 | } 117 | }; 118 | 119 | 120 | /** 121 | * Configures a monitor to wrap all entry points. 122 | * 123 | * Entry points that have already been registered are immediately wrapped by 124 | * the monitor. When an entry point is registered in the future, it will also 125 | * be wrapped by the monitor when it is registered. 126 | * 127 | * @param {!goog.debug.EntryPointMonitor} monitor An entry point monitor. 128 | */ 129 | goog.debug.entryPointRegistry.monitorAll = function(monitor) { 130 | goog.debug.entryPointRegistry.monitorsMayExist_ = true; 131 | var transformer = goog.bind(monitor.wrap, monitor); 132 | for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) { 133 | goog.debug.entryPointRegistry.refList_[i](transformer); 134 | } 135 | goog.debug.entryPointRegistry.monitors_.push(monitor); 136 | }; 137 | 138 | 139 | /** 140 | * Try to unmonitor all the entry points that have already been registered. If 141 | * an entry point is registered in the future, it will not be wrapped by the 142 | * monitor when it is registered. Note that this may fail if the entry points 143 | * have additional wrapping. 144 | * 145 | * @param {!goog.debug.EntryPointMonitor} monitor The last monitor to wrap 146 | * the entry points. 147 | * @throws {Error} If the monitor is not the most recently configured monitor. 148 | */ 149 | goog.debug.entryPointRegistry.unmonitorAllIfPossible = function(monitor) { 150 | var monitors = goog.debug.entryPointRegistry.monitors_; 151 | goog.asserts.assert( 152 | monitor == monitors[monitors.length - 1], 153 | 'Only the most recent monitor can be unwrapped.'); 154 | var transformer = goog.bind(monitor.unwrap, monitor); 155 | for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) { 156 | goog.debug.entryPointRegistry.refList_[i](transformer); 157 | } 158 | monitors.length--; 159 | }; 160 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/debug/error.js: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Provides a base class for custom Error objects such that the 17 | * stack is correctly maintained. 18 | * 19 | * You should never need to throw goog.debug.Error(msg) directly, Error(msg) is 20 | * sufficient. 21 | * 22 | */ 23 | 24 | goog.provide('goog.debug.Error'); 25 | 26 | 27 | 28 | /** 29 | * Base class for custom error objects. 30 | * @param {*=} opt_msg The message associated with the error. 31 | * @constructor 32 | * @extends {Error} 33 | */ 34 | goog.debug.Error = function(opt_msg) { 35 | 36 | // Attempt to ensure there is a stack trace. 37 | if (Error.captureStackTrace) { 38 | Error.captureStackTrace(this, goog.debug.Error); 39 | } else { 40 | var stack = new Error().stack; 41 | if (stack) { 42 | this.stack = stack; 43 | } 44 | } 45 | 46 | if (opt_msg) { 47 | this.message = String(opt_msg); 48 | } 49 | 50 | /** 51 | * Whether to report this error to the server. Setting this to false will 52 | * cause the error reporter to not report the error back to the server, 53 | * which can be useful if the client knows that the error has already been 54 | * logged on the server. 55 | * @type {boolean} 56 | */ 57 | this.reportErrorToServer = true; 58 | }; 59 | goog.inherits(goog.debug.Error, Error); 60 | 61 | 62 | /** @override */ 63 | goog.debug.Error.prototype.name = 'CustomError'; 64 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/disposable/disposable.js: -------------------------------------------------------------------------------- 1 | // Copyright 2005 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Implements the disposable interface. The dispose method is used 17 | * to clean up references and resources. 18 | * @author arv@google.com (Erik Arvidsson) 19 | */ 20 | 21 | 22 | goog.provide('goog.Disposable'); 23 | goog.provide('goog.dispose'); 24 | goog.provide('goog.disposeAll'); 25 | 26 | goog.require('goog.disposable.IDisposable'); 27 | 28 | 29 | 30 | /** 31 | * Class that provides the basic implementation for disposable objects. If your 32 | * class holds one or more references to COM objects, DOM nodes, or other 33 | * disposable objects, it should extend this class or implement the disposable 34 | * interface (defined in goog.disposable.IDisposable). 35 | * @constructor 36 | * @implements {goog.disposable.IDisposable} 37 | */ 38 | goog.Disposable = function() { 39 | /** 40 | * If monitoring the goog.Disposable instances is enabled, stores the creation 41 | * stack trace of the Disposable instance. 42 | * @type {string|undefined} 43 | */ 44 | this.creationStack; 45 | 46 | if (goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF) { 47 | if (goog.Disposable.INCLUDE_STACK_ON_CREATION) { 48 | this.creationStack = new Error().stack; 49 | } 50 | goog.Disposable.instances_[goog.getUid(this)] = this; 51 | } 52 | // Support sealing 53 | this.disposed_ = this.disposed_; 54 | this.onDisposeCallbacks_ = this.onDisposeCallbacks_; 55 | }; 56 | 57 | 58 | /** 59 | * @enum {number} Different monitoring modes for Disposable. 60 | */ 61 | goog.Disposable.MonitoringMode = { 62 | /** 63 | * No monitoring. 64 | */ 65 | OFF: 0, 66 | /** 67 | * Creating and disposing the goog.Disposable instances is monitored. All 68 | * disposable objects need to call the {@code goog.Disposable} base 69 | * constructor. The PERMANENT mode must be switched on before creating any 70 | * goog.Disposable instances. 71 | */ 72 | PERMANENT: 1, 73 | /** 74 | * INTERACTIVE mode can be switched on and off on the fly without producing 75 | * errors. It also doesn't warn if the disposable objects don't call the 76 | * {@code goog.Disposable} base constructor. 77 | */ 78 | INTERACTIVE: 2 79 | }; 80 | 81 | 82 | /** 83 | * @define {number} The monitoring mode of the goog.Disposable 84 | * instances. Default is OFF. Switching on the monitoring is only 85 | * recommended for debugging because it has a significant impact on 86 | * performance and memory usage. If switched off, the monitoring code 87 | * compiles down to 0 bytes. 88 | */ 89 | goog.define('goog.Disposable.MONITORING_MODE', 0); 90 | 91 | 92 | /** 93 | * @define {boolean} Whether to attach creation stack to each created disposable 94 | * instance; This is only relevant for when MonitoringMode != OFF. 95 | */ 96 | goog.define('goog.Disposable.INCLUDE_STACK_ON_CREATION', true); 97 | 98 | 99 | /** 100 | * Maps the unique ID of every undisposed {@code goog.Disposable} object to 101 | * the object itself. 102 | * @type {!Object} 103 | * @private 104 | */ 105 | goog.Disposable.instances_ = {}; 106 | 107 | 108 | /** 109 | * @return {!Array} All {@code goog.Disposable} objects that 110 | * haven't been disposed of. 111 | */ 112 | goog.Disposable.getUndisposedObjects = function() { 113 | var ret = []; 114 | for (var id in goog.Disposable.instances_) { 115 | if (goog.Disposable.instances_.hasOwnProperty(id)) { 116 | ret.push(goog.Disposable.instances_[Number(id)]); 117 | } 118 | } 119 | return ret; 120 | }; 121 | 122 | 123 | /** 124 | * Clears the registry of undisposed objects but doesn't dispose of them. 125 | */ 126 | goog.Disposable.clearUndisposedObjects = function() { 127 | goog.Disposable.instances_ = {}; 128 | }; 129 | 130 | 131 | /** 132 | * Whether the object has been disposed of. 133 | * @type {boolean} 134 | * @private 135 | */ 136 | goog.Disposable.prototype.disposed_ = false; 137 | 138 | 139 | /** 140 | * Callbacks to invoke when this object is disposed. 141 | * @type {Array} 142 | * @private 143 | */ 144 | goog.Disposable.prototype.onDisposeCallbacks_; 145 | 146 | 147 | /** 148 | * @return {boolean} Whether the object has been disposed of. 149 | * @override 150 | */ 151 | goog.Disposable.prototype.isDisposed = function() { 152 | return this.disposed_; 153 | }; 154 | 155 | 156 | /** 157 | * @return {boolean} Whether the object has been disposed of. 158 | * @deprecated Use {@link #isDisposed} instead. 159 | */ 160 | goog.Disposable.prototype.getDisposed = goog.Disposable.prototype.isDisposed; 161 | 162 | 163 | /** 164 | * Disposes of the object. If the object hasn't already been disposed of, calls 165 | * {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should 166 | * override {@link #disposeInternal} in order to delete references to COM 167 | * objects, DOM nodes, and other disposable objects. Reentrant. 168 | * 169 | * @return {void} Nothing. 170 | * @override 171 | */ 172 | goog.Disposable.prototype.dispose = function() { 173 | if (!this.disposed_) { 174 | // Set disposed_ to true first, in case during the chain of disposal this 175 | // gets disposed recursively. 176 | this.disposed_ = true; 177 | this.disposeInternal(); 178 | if (goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF) { 179 | var uid = goog.getUid(this); 180 | if (goog.Disposable.MONITORING_MODE == 181 | goog.Disposable.MonitoringMode.PERMANENT && 182 | !goog.Disposable.instances_.hasOwnProperty(uid)) { 183 | throw Error( 184 | this + ' did not call the goog.Disposable base ' + 185 | 'constructor or was disposed of after a clearUndisposedObjects ' + 186 | 'call'); 187 | } 188 | delete goog.Disposable.instances_[uid]; 189 | } 190 | } 191 | }; 192 | 193 | 194 | /** 195 | * Associates a disposable object with this object so that they will be disposed 196 | * together. 197 | * @param {goog.disposable.IDisposable} disposable that will be disposed when 198 | * this object is disposed. 199 | */ 200 | goog.Disposable.prototype.registerDisposable = function(disposable) { 201 | this.addOnDisposeCallback(goog.partial(goog.dispose, disposable)); 202 | }; 203 | 204 | 205 | /** 206 | * Invokes a callback function when this object is disposed. Callbacks are 207 | * invoked in the order in which they were added. If a callback is added to 208 | * an already disposed Disposable, it will be called immediately. 209 | * @param {function(this:T):?} callback The callback function. 210 | * @param {T=} opt_scope An optional scope to call the callback in. 211 | * @template T 212 | */ 213 | goog.Disposable.prototype.addOnDisposeCallback = function(callback, opt_scope) { 214 | if (this.disposed_) { 215 | goog.isDef(opt_scope) ? callback.call(opt_scope) : callback(); 216 | return; 217 | } 218 | if (!this.onDisposeCallbacks_) { 219 | this.onDisposeCallbacks_ = []; 220 | } 221 | 222 | this.onDisposeCallbacks_.push( 223 | goog.isDef(opt_scope) ? goog.bind(callback, opt_scope) : callback); 224 | }; 225 | 226 | 227 | /** 228 | * Deletes or nulls out any references to COM objects, DOM nodes, or other 229 | * disposable objects. Classes that extend {@code goog.Disposable} should 230 | * override this method. 231 | * Not reentrant. To avoid calling it twice, it must only be called from the 232 | * subclass' {@code disposeInternal} method. Everywhere else the public 233 | * {@code dispose} method must be used. 234 | * For example: 235 | *
236 |  *   mypackage.MyClass = function() {
237 |  *     mypackage.MyClass.base(this, 'constructor');
238 |  *     // Constructor logic specific to MyClass.
239 |  *     ...
240 |  *   };
241 |  *   goog.inherits(mypackage.MyClass, goog.Disposable);
242 |  *
243 |  *   mypackage.MyClass.prototype.disposeInternal = function() {
244 |  *     // Dispose logic specific to MyClass.
245 |  *     ...
246 |  *     // Call superclass's disposeInternal at the end of the subclass's, like
247 |  *     // in C++, to avoid hard-to-catch issues.
248 |  *     mypackage.MyClass.base(this, 'disposeInternal');
249 |  *   };
250 |  * 
251 | * @protected 252 | */ 253 | goog.Disposable.prototype.disposeInternal = function() { 254 | if (this.onDisposeCallbacks_) { 255 | while (this.onDisposeCallbacks_.length) { 256 | this.onDisposeCallbacks_.shift()(); 257 | } 258 | } 259 | }; 260 | 261 | 262 | /** 263 | * Returns True if we can verify the object is disposed. 264 | * Calls {@code isDisposed} on the argument if it supports it. If obj 265 | * is not an object with an isDisposed() method, return false. 266 | * @param {*} obj The object to investigate. 267 | * @return {boolean} True if we can verify the object is disposed. 268 | */ 269 | goog.Disposable.isDisposed = function(obj) { 270 | if (obj && typeof obj.isDisposed == 'function') { 271 | return obj.isDisposed(); 272 | } 273 | return false; 274 | }; 275 | 276 | 277 | /** 278 | * Calls {@code dispose} on the argument if it supports it. If obj is not an 279 | * object with a dispose() method, this is a no-op. 280 | * @param {*} obj The object to dispose of. 281 | */ 282 | goog.dispose = function(obj) { 283 | if (obj && typeof obj.dispose == 'function') { 284 | obj.dispose(); 285 | } 286 | }; 287 | 288 | 289 | /** 290 | * Calls {@code dispose} on each member of the list that supports it. (If the 291 | * member is an ArrayLike, then {@code goog.disposeAll()} will be called 292 | * recursively on each of its members.) If the member is not an object with a 293 | * {@code dispose()} method, then it is ignored. 294 | * @param {...*} var_args The list. 295 | */ 296 | goog.disposeAll = function(var_args) { 297 | for (var i = 0, len = arguments.length; i < len; ++i) { 298 | var disposable = arguments[i]; 299 | if (goog.isArrayLike(disposable)) { 300 | goog.disposeAll.apply(null, disposable); 301 | } else { 302 | goog.dispose(disposable); 303 | } 304 | } 305 | }; 306 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/disposable/idisposable.js: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Definition of the disposable interface. A disposable object 17 | * has a dispose method to to clean up references and resources. 18 | * @author nnaze@google.com (Nathan Naze) 19 | */ 20 | 21 | 22 | goog.provide('goog.disposable.IDisposable'); 23 | 24 | 25 | 26 | /** 27 | * Interface for a disposable object. If a instance requires cleanup 28 | * (references COM objects, DOM nodes, or other disposable objects), it should 29 | * implement this interface (it may subclass goog.Disposable). 30 | * @record 31 | */ 32 | goog.disposable.IDisposable = function() {}; 33 | 34 | 35 | /** 36 | * Disposes of the object and its resources. 37 | * @return {void} Nothing. 38 | */ 39 | goog.disposable.IDisposable.prototype.dispose = goog.abstractMethod; 40 | 41 | 42 | /** 43 | * @return {boolean} Whether the object has been disposed of. 44 | */ 45 | goog.disposable.IDisposable.prototype.isDisposed = goog.abstractMethod; 46 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/dom/nodetype.js: -------------------------------------------------------------------------------- 1 | // Copyright 2006 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Definition of goog.dom.NodeType. 17 | */ 18 | 19 | goog.provide('goog.dom.NodeType'); 20 | 21 | 22 | /** 23 | * Constants for the nodeType attribute in the Node interface. 24 | * 25 | * These constants match those specified in the Node interface. These are 26 | * usually present on the Node object in recent browsers, but not in older 27 | * browsers (specifically, early IEs) and thus are given here. 28 | * 29 | * In some browsers (early IEs), these are not defined on the Node object, 30 | * so they are provided here. 31 | * 32 | * See http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247 33 | * @enum {number} 34 | */ 35 | goog.dom.NodeType = { 36 | ELEMENT: 1, 37 | ATTRIBUTE: 2, 38 | TEXT: 3, 39 | CDATA_SECTION: 4, 40 | ENTITY_REFERENCE: 5, 41 | ENTITY: 6, 42 | PROCESSING_INSTRUCTION: 7, 43 | COMMENT: 8, 44 | DOCUMENT: 9, 45 | DOCUMENT_TYPE: 10, 46 | DOCUMENT_FRAGMENT: 11, 47 | NOTATION: 12 48 | }; 49 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/events/browserfeature.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Browser capability checks for the events package. 17 | * 18 | */ 19 | 20 | 21 | goog.provide('goog.events.BrowserFeature'); 22 | 23 | goog.require('goog.userAgent'); 24 | 25 | 26 | /** 27 | * Enum of browser capabilities. 28 | * @enum {boolean} 29 | */ 30 | goog.events.BrowserFeature = { 31 | /** 32 | * Whether the button attribute of the event is W3C compliant. False in 33 | * Internet Explorer prior to version 9; document-version dependent. 34 | */ 35 | HAS_W3C_BUTTON: 36 | !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9), 37 | 38 | /** 39 | * Whether the browser supports full W3C event model. 40 | */ 41 | HAS_W3C_EVENT_SUPPORT: 42 | !goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9), 43 | 44 | /** 45 | * To prevent default in IE7-8 for certain keydown events we need set the 46 | * keyCode to -1. 47 | */ 48 | SET_KEY_CODE_TO_PREVENT_DEFAULT: 49 | goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9'), 50 | 51 | /** 52 | * Whether the {@code navigator.onLine} property is supported. 53 | */ 54 | HAS_NAVIGATOR_ONLINE_PROPERTY: 55 | !goog.userAgent.WEBKIT || goog.userAgent.isVersionOrHigher('528'), 56 | 57 | /** 58 | * Whether HTML5 network online/offline events are supported. 59 | */ 60 | HAS_HTML5_NETWORK_EVENT_SUPPORT: 61 | goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher('1.9b') || 62 | goog.userAgent.IE && goog.userAgent.isVersionOrHigher('8') || 63 | goog.userAgent.OPERA && goog.userAgent.isVersionOrHigher('9.5') || 64 | goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher('528'), 65 | 66 | /** 67 | * Whether HTML5 network events fire on document.body, or otherwise the 68 | * window. 69 | */ 70 | HTML5_NETWORK_EVENTS_FIRE_ON_BODY: 71 | goog.userAgent.GECKO && !goog.userAgent.isVersionOrHigher('8') || 72 | goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9'), 73 | 74 | /** 75 | * Whether touch is enabled in the browser. 76 | */ 77 | TOUCH_ENABLED: 78 | ('ontouchstart' in goog.global || 79 | !!(goog.global['document'] && document.documentElement && 80 | 'ontouchstart' in document.documentElement) || 81 | // IE10 uses non-standard touch events, so it has a different check. 82 | !!(goog.global['navigator'] && 83 | goog.global['navigator']['msMaxTouchPoints'])) 84 | }; 85 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/events/event.js: -------------------------------------------------------------------------------- 1 | // Copyright 2005 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview A base class for event objects. 17 | * 18 | */ 19 | 20 | 21 | goog.provide('goog.events.Event'); 22 | goog.provide('goog.events.EventLike'); 23 | 24 | /** 25 | * goog.events.Event no longer depends on goog.Disposable. Keep requiring 26 | * goog.Disposable here to not break projects which assume this dependency. 27 | * @suppress {extraRequire} 28 | */ 29 | goog.require('goog.Disposable'); 30 | goog.require('goog.events.EventId'); 31 | 32 | 33 | /** 34 | * A typedef for event like objects that are dispatchable via the 35 | * goog.events.dispatchEvent function. strings are treated as the type for a 36 | * goog.events.Event. Objects are treated as an extension of a new 37 | * goog.events.Event with the type property of the object being used as the type 38 | * of the Event. 39 | * @typedef {string|Object|goog.events.Event|goog.events.EventId} 40 | */ 41 | goog.events.EventLike; 42 | 43 | 44 | 45 | /** 46 | * A base class for event objects, so that they can support preventDefault and 47 | * stopPropagation. 48 | * 49 | * @suppress {underscore} Several properties on this class are technically 50 | * public, but referencing these properties outside this package is strongly 51 | * discouraged. 52 | * 53 | * @param {string|!goog.events.EventId} type Event Type. 54 | * @param {Object=} opt_target Reference to the object that is the target of 55 | * this event. It has to implement the {@code EventTarget} interface 56 | * declared at {@link http://developer.mozilla.org/en/DOM/EventTarget}. 57 | * @constructor 58 | */ 59 | goog.events.Event = function(type, opt_target) { 60 | /** 61 | * Event type. 62 | * @type {string} 63 | */ 64 | this.type = type instanceof goog.events.EventId ? String(type) : type; 65 | 66 | /** 67 | * TODO(tbreisacher): The type should probably be 68 | * EventTarget|goog.events.EventTarget. 69 | * 70 | * Target of the event. 71 | * @type {Object|undefined} 72 | */ 73 | this.target = opt_target; 74 | 75 | /** 76 | * Object that had the listener attached. 77 | * @type {Object|undefined} 78 | */ 79 | this.currentTarget = this.target; 80 | 81 | /** 82 | * Whether to cancel the event in internal capture/bubble processing for IE. 83 | * @type {boolean} 84 | * @public 85 | */ 86 | this.propagationStopped_ = false; 87 | 88 | /** 89 | * Whether the default action has been prevented. 90 | * This is a property to match the W3C specification at 91 | * {@link http://www.w3.org/TR/DOM-Level-3-Events/ 92 | * #events-event-type-defaultPrevented}. 93 | * Must be treated as read-only outside the class. 94 | * @type {boolean} 95 | */ 96 | this.defaultPrevented = false; 97 | 98 | /** 99 | * Return value for in internal capture/bubble processing for IE. 100 | * @type {boolean} 101 | * @public 102 | */ 103 | this.returnValue_ = true; 104 | }; 105 | 106 | 107 | /** 108 | * Stops event propagation. 109 | */ 110 | goog.events.Event.prototype.stopPropagation = function() { 111 | this.propagationStopped_ = true; 112 | }; 113 | 114 | 115 | /** 116 | * Prevents the default action, for example a link redirecting to a url. 117 | */ 118 | goog.events.Event.prototype.preventDefault = function() { 119 | this.defaultPrevented = true; 120 | this.returnValue_ = false; 121 | }; 122 | 123 | 124 | /** 125 | * Stops the propagation of the event. It is equivalent to 126 | * {@code e.stopPropagation()}, but can be used as the callback argument of 127 | * {@link goog.events.listen} without declaring another function. 128 | * @param {!goog.events.Event} e An event. 129 | */ 130 | goog.events.Event.stopPropagation = function(e) { 131 | e.stopPropagation(); 132 | }; 133 | 134 | 135 | /** 136 | * Prevents the default action. It is equivalent to 137 | * {@code e.preventDefault()}, but can be used as the callback argument of 138 | * {@link goog.events.listen} without declaring another function. 139 | * @param {!goog.events.Event} e An event. 140 | */ 141 | goog.events.Event.preventDefault = function(e) { 142 | e.preventDefault(); 143 | }; 144 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/events/eventid.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | goog.provide('goog.events.EventId'); 16 | 17 | 18 | 19 | /** 20 | * A templated class that is used when registering for events. Typical usage: 21 | * 22 | * /** @type {goog.events.EventId} *\ 23 | * var myEventId = new goog.events.EventId( 24 | * goog.events.getUniqueId(('someEvent')); 25 | * 26 | * // No need to cast or declare here since the compiler knows the 27 | * // correct type of 'evt' (MyEventObj). 28 | * something.listen(myEventId, function(evt) {}); 29 | * 30 | * @param {string} eventId 31 | * @template T 32 | * @constructor 33 | * @struct 34 | * @final 35 | */ 36 | goog.events.EventId = function(eventId) { 37 | /** @const */ this.id = eventId; 38 | }; 39 | 40 | 41 | /** 42 | * @override 43 | */ 44 | goog.events.EventId.prototype.toString = function() { 45 | return this.id; 46 | }; 47 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/events/eventtype.js: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Event Types. 17 | * 18 | * @author arv@google.com (Erik Arvidsson) 19 | */ 20 | 21 | 22 | goog.provide('goog.events.EventType'); 23 | 24 | goog.require('goog.userAgent'); 25 | 26 | 27 | /** 28 | * Returns a prefixed event name for the current browser. 29 | * @param {string} eventName The name of the event. 30 | * @return {string} The prefixed event name. 31 | * @suppress {missingRequire|missingProvide} 32 | * @private 33 | */ 34 | goog.events.getVendorPrefixedName_ = function(eventName) { 35 | return goog.userAgent.WEBKIT ? 36 | 'webkit' + eventName : 37 | (goog.userAgent.OPERA ? 'o' + eventName.toLowerCase() : 38 | eventName.toLowerCase()); 39 | }; 40 | 41 | 42 | /** 43 | * Constants for event names. 44 | * @enum {string} 45 | */ 46 | goog.events.EventType = { 47 | // Mouse events 48 | CLICK: 'click', 49 | RIGHTCLICK: 'rightclick', 50 | DBLCLICK: 'dblclick', 51 | MOUSEDOWN: 'mousedown', 52 | MOUSEUP: 'mouseup', 53 | MOUSEOVER: 'mouseover', 54 | MOUSEOUT: 'mouseout', 55 | MOUSEMOVE: 'mousemove', 56 | MOUSEENTER: 'mouseenter', 57 | MOUSELEAVE: 'mouseleave', 58 | 59 | // Selection events. 60 | // https://www.w3.org/TR/selection-api/ 61 | SELECTIONCHANGE: 'selectionchange', 62 | SELECTSTART: 'selectstart', // IE, Safari, Chrome 63 | 64 | // Wheel events 65 | // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents 66 | WHEEL: 'wheel', 67 | 68 | // Key events 69 | KEYPRESS: 'keypress', 70 | KEYDOWN: 'keydown', 71 | KEYUP: 'keyup', 72 | 73 | // Focus 74 | BLUR: 'blur', 75 | FOCUS: 'focus', 76 | DEACTIVATE: 'deactivate', // IE only 77 | // NOTE: The following two events are not stable in cross-browser usage. 78 | // WebKit and Opera implement DOMFocusIn/Out. 79 | // IE implements focusin/out. 80 | // Gecko implements neither see bug at 81 | // https://bugzilla.mozilla.org/show_bug.cgi?id=396927. 82 | // The DOM Events Level 3 Draft deprecates DOMFocusIn in favor of focusin: 83 | // http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html 84 | // You can use FOCUS in Capture phase until implementations converge. 85 | FOCUSIN: goog.userAgent.IE ? 'focusin' : 'DOMFocusIn', 86 | FOCUSOUT: goog.userAgent.IE ? 'focusout' : 'DOMFocusOut', 87 | 88 | // Forms 89 | CHANGE: 'change', 90 | RESET: 'reset', 91 | SELECT: 'select', 92 | SUBMIT: 'submit', 93 | INPUT: 'input', 94 | PROPERTYCHANGE: 'propertychange', // IE only 95 | 96 | // Drag and drop 97 | DRAGSTART: 'dragstart', 98 | DRAG: 'drag', 99 | DRAGENTER: 'dragenter', 100 | DRAGOVER: 'dragover', 101 | DRAGLEAVE: 'dragleave', 102 | DROP: 'drop', 103 | DRAGEND: 'dragend', 104 | 105 | // Touch events 106 | // Note that other touch events exist, but we should follow the W3C list here. 107 | // http://www.w3.org/TR/touch-events/#list-of-touchevent-types 108 | TOUCHSTART: 'touchstart', 109 | TOUCHMOVE: 'touchmove', 110 | TOUCHEND: 'touchend', 111 | TOUCHCANCEL: 'touchcancel', 112 | 113 | // Misc 114 | BEFOREUNLOAD: 'beforeunload', 115 | CONSOLEMESSAGE: 'consolemessage', 116 | CONTEXTMENU: 'contextmenu', 117 | DEVICEMOTION: 'devicemotion', 118 | DEVICEORIENTATION: 'deviceorientation', 119 | DOMCONTENTLOADED: 'DOMContentLoaded', 120 | ERROR: 'error', 121 | HELP: 'help', 122 | LOAD: 'load', 123 | LOSECAPTURE: 'losecapture', 124 | ORIENTATIONCHANGE: 'orientationchange', 125 | READYSTATECHANGE: 'readystatechange', 126 | RESIZE: 'resize', 127 | SCROLL: 'scroll', 128 | UNLOAD: 'unload', 129 | 130 | // Media events 131 | CANPLAY: 'canplay', 132 | CANPLAYTHROUGH: 'canplaythrough', 133 | DURATIONCHANGE: 'durationchange', 134 | EMPTIED: 'emptied', 135 | ENDED: 'ended', 136 | LOADEDDATA: 'loadeddata', 137 | LOADEDMETADATA: 'loadedmetadata', 138 | PAUSE: 'pause', 139 | PLAY: 'play', 140 | PLAYING: 'playing', 141 | RATECHANGE: 'ratechange', 142 | SEEKED: 'seeked', 143 | SEEKING: 'seeking', 144 | STALLED: 'stalled', 145 | SUSPEND: 'suspend', 146 | TIMEUPDATE: 'timeupdate', 147 | VOLUMECHANGE: 'volumechange', 148 | WAITING: 'waiting', 149 | 150 | // Media Source Extensions events 151 | // https://www.w3.org/TR/media-source/#mediasource-events 152 | SOURCEOPEN: 'sourceopen', 153 | SOURCEENDED: 'sourceended', 154 | SOURCECLOSED: 'sourceclosed', 155 | // https://www.w3.org/TR/media-source/#sourcebuffer-events 156 | ABORT: 'abort', 157 | UPDATE: 'update', 158 | UPDATESTART: 'updatestart', 159 | UPDATEEND: 'updateend', 160 | 161 | // HTML 5 History events 162 | // See http://www.w3.org/TR/html5/browsers.html#event-definitions-0 163 | HASHCHANGE: 'hashchange', 164 | PAGEHIDE: 'pagehide', 165 | PAGESHOW: 'pageshow', 166 | POPSTATE: 'popstate', 167 | 168 | // Copy and Paste 169 | // Support is limited. Make sure it works on your favorite browser 170 | // before using. 171 | // http://www.quirksmode.org/dom/events/cutcopypaste.html 172 | COPY: 'copy', 173 | PASTE: 'paste', 174 | CUT: 'cut', 175 | BEFORECOPY: 'beforecopy', 176 | BEFORECUT: 'beforecut', 177 | BEFOREPASTE: 'beforepaste', 178 | 179 | // HTML5 online/offline events. 180 | // http://www.w3.org/TR/offline-webapps/#related 181 | ONLINE: 'online', 182 | OFFLINE: 'offline', 183 | 184 | // HTML 5 worker events 185 | MESSAGE: 'message', 186 | CONNECT: 'connect', 187 | 188 | // CSS animation events. 189 | /** @suppress {missingRequire} */ 190 | ANIMATIONSTART: goog.events.getVendorPrefixedName_('AnimationStart'), 191 | /** @suppress {missingRequire} */ 192 | ANIMATIONEND: goog.events.getVendorPrefixedName_('AnimationEnd'), 193 | /** @suppress {missingRequire} */ 194 | ANIMATIONITERATION: goog.events.getVendorPrefixedName_('AnimationIteration'), 195 | 196 | // CSS transition events. Based on the browser support described at: 197 | // https://developer.mozilla.org/en/css/css_transitions#Browser_compatibility 198 | /** @suppress {missingRequire} */ 199 | TRANSITIONEND: goog.events.getVendorPrefixedName_('TransitionEnd'), 200 | 201 | // W3C Pointer Events 202 | // http://www.w3.org/TR/pointerevents/ 203 | POINTERDOWN: 'pointerdown', 204 | POINTERUP: 'pointerup', 205 | POINTERCANCEL: 'pointercancel', 206 | POINTERMOVE: 'pointermove', 207 | POINTEROVER: 'pointerover', 208 | POINTEROUT: 'pointerout', 209 | POINTERENTER: 'pointerenter', 210 | POINTERLEAVE: 'pointerleave', 211 | GOTPOINTERCAPTURE: 'gotpointercapture', 212 | LOSTPOINTERCAPTURE: 'lostpointercapture', 213 | 214 | // IE specific events. 215 | // See http://msdn.microsoft.com/en-us/library/ie/hh772103(v=vs.85).aspx 216 | // Note: these events will be supplanted in IE11. 217 | MSGESTURECHANGE: 'MSGestureChange', 218 | MSGESTUREEND: 'MSGestureEnd', 219 | MSGESTUREHOLD: 'MSGestureHold', 220 | MSGESTURESTART: 'MSGestureStart', 221 | MSGESTURETAP: 'MSGestureTap', 222 | MSGOTPOINTERCAPTURE: 'MSGotPointerCapture', 223 | MSINERTIASTART: 'MSInertiaStart', 224 | MSLOSTPOINTERCAPTURE: 'MSLostPointerCapture', 225 | MSPOINTERCANCEL: 'MSPointerCancel', 226 | MSPOINTERDOWN: 'MSPointerDown', 227 | MSPOINTERENTER: 'MSPointerEnter', 228 | MSPOINTERHOVER: 'MSPointerHover', 229 | MSPOINTERLEAVE: 'MSPointerLeave', 230 | MSPOINTERMOVE: 'MSPointerMove', 231 | MSPOINTEROUT: 'MSPointerOut', 232 | MSPOINTEROVER: 'MSPointerOver', 233 | MSPOINTERUP: 'MSPointerUp', 234 | 235 | // Native IMEs/input tools events. 236 | TEXT: 'text', 237 | // The textInput event is supported in IE9+, but only in lower case. All other 238 | // browsers use the camel-case event name. 239 | TEXTINPUT: goog.userAgent.IE ? 'textinput' : 'textInput', 240 | COMPOSITIONSTART: 'compositionstart', 241 | COMPOSITIONUPDATE: 'compositionupdate', 242 | COMPOSITIONEND: 'compositionend', 243 | 244 | // The beforeinput event is initially only supported in Safari. See 245 | // https://bugs.chromium.org/p/chromium/issues/detail?id=342670 for Chrome 246 | // implementation tracking. 247 | BEFOREINPUT: 'beforeinput', 248 | 249 | // Webview tag events 250 | // See http://developer.chrome.com/dev/apps/webview_tag.html 251 | EXIT: 'exit', 252 | LOADABORT: 'loadabort', 253 | LOADCOMMIT: 'loadcommit', 254 | LOADREDIRECT: 'loadredirect', 255 | LOADSTART: 'loadstart', 256 | LOADSTOP: 'loadstop', 257 | RESPONSIVE: 'responsive', 258 | SIZECHANGED: 'sizechanged', 259 | UNRESPONSIVE: 'unresponsive', 260 | 261 | // HTML5 Page Visibility API. See details at 262 | // {@code goog.labs.dom.PageVisibilityMonitor}. 263 | VISIBILITYCHANGE: 'visibilitychange', 264 | 265 | // LocalStorage event. 266 | STORAGE: 'storage', 267 | 268 | // DOM Level 2 mutation events (deprecated). 269 | DOMSUBTREEMODIFIED: 'DOMSubtreeModified', 270 | DOMNODEINSERTED: 'DOMNodeInserted', 271 | DOMNODEREMOVED: 'DOMNodeRemoved', 272 | DOMNODEREMOVEDFROMDOCUMENT: 'DOMNodeRemovedFromDocument', 273 | DOMNODEINSERTEDINTODOCUMENT: 'DOMNodeInsertedIntoDocument', 274 | DOMATTRMODIFIED: 'DOMAttrModified', 275 | DOMCHARACTERDATAMODIFIED: 'DOMCharacterDataModified', 276 | 277 | // Print events. 278 | BEFOREPRINT: 'beforeprint', 279 | AFTERPRINT: 'afterprint' 280 | }; 281 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/events/listener.js: -------------------------------------------------------------------------------- 1 | // Copyright 2005 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Listener object. 17 | * @see ../demos/events.html 18 | */ 19 | 20 | goog.provide('goog.events.Listener'); 21 | 22 | goog.require('goog.events.ListenableKey'); 23 | 24 | 25 | 26 | /** 27 | * Simple class that stores information about a listener 28 | * @param {function(?):?} listener Callback function. 29 | * @param {Function} proxy Wrapper for the listener that patches the event. 30 | * @param {EventTarget|goog.events.Listenable} src Source object for 31 | * the event. 32 | * @param {string} type Event type. 33 | * @param {boolean} capture Whether in capture or bubble phase. 34 | * @param {Object=} opt_handler Object in whose context to execute the callback. 35 | * @implements {goog.events.ListenableKey} 36 | * @constructor 37 | */ 38 | goog.events.Listener = function( 39 | listener, proxy, src, type, capture, opt_handler) { 40 | if (goog.events.Listener.ENABLE_MONITORING) { 41 | this.creationStack = new Error().stack; 42 | } 43 | 44 | /** @override */ 45 | this.listener = listener; 46 | 47 | /** 48 | * A wrapper over the original listener. This is used solely to 49 | * handle native browser events (it is used to simulate the capture 50 | * phase and to patch the event object). 51 | * @type {Function} 52 | */ 53 | this.proxy = proxy; 54 | 55 | /** 56 | * Object or node that callback is listening to 57 | * @type {EventTarget|goog.events.Listenable} 58 | */ 59 | this.src = src; 60 | 61 | /** 62 | * The event type. 63 | * @const {string} 64 | */ 65 | this.type = type; 66 | 67 | /** 68 | * Whether the listener is being called in the capture or bubble phase 69 | * @const {boolean} 70 | */ 71 | this.capture = !!capture; 72 | 73 | /** 74 | * Optional object whose context to execute the listener in 75 | * @type {Object|undefined} 76 | */ 77 | this.handler = opt_handler; 78 | 79 | /** 80 | * The key of the listener. 81 | * @const {number} 82 | * @override 83 | */ 84 | this.key = goog.events.ListenableKey.reserveKey(); 85 | 86 | /** 87 | * Whether to remove the listener after it has been called. 88 | * @type {boolean} 89 | */ 90 | this.callOnce = false; 91 | 92 | /** 93 | * Whether the listener has been removed. 94 | * @type {boolean} 95 | */ 96 | this.removed = false; 97 | }; 98 | 99 | 100 | /** 101 | * @define {boolean} Whether to enable the monitoring of the 102 | * goog.events.Listener instances. Switching on the monitoring is only 103 | * recommended for debugging because it has a significant impact on 104 | * performance and memory usage. If switched off, the monitoring code 105 | * compiles down to 0 bytes. 106 | */ 107 | goog.define('goog.events.Listener.ENABLE_MONITORING', false); 108 | 109 | 110 | /** 111 | * If monitoring the goog.events.Listener instances is enabled, stores the 112 | * creation stack trace of the Disposable instance. 113 | * @type {string} 114 | */ 115 | goog.events.Listener.prototype.creationStack; 116 | 117 | 118 | /** 119 | * Marks this listener as removed. This also remove references held by 120 | * this listener object (such as listener and event source). 121 | */ 122 | goog.events.Listener.prototype.markAsRemoved = function() { 123 | this.removed = true; 124 | this.listener = null; 125 | this.proxy = null; 126 | this.src = null; 127 | this.handler = null; 128 | }; 129 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/labs/useragent/engine.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Closure user agent detection. 17 | * @see http://en.wikipedia.org/wiki/User_agent 18 | * For more information on browser brand, platform, or device see the other 19 | * sub-namespaces in goog.labs.userAgent (browser, platform, and device). 20 | * 21 | */ 22 | 23 | goog.provide('goog.labs.userAgent.engine'); 24 | 25 | goog.require('goog.array'); 26 | goog.require('goog.labs.userAgent.util'); 27 | goog.require('goog.string'); 28 | 29 | 30 | /** 31 | * @return {boolean} Whether the rendering engine is Presto. 32 | */ 33 | goog.labs.userAgent.engine.isPresto = function() { 34 | return goog.labs.userAgent.util.matchUserAgent('Presto'); 35 | }; 36 | 37 | 38 | /** 39 | * @return {boolean} Whether the rendering engine is Trident. 40 | */ 41 | goog.labs.userAgent.engine.isTrident = function() { 42 | // IE only started including the Trident token in IE8. 43 | return goog.labs.userAgent.util.matchUserAgent('Trident') || 44 | goog.labs.userAgent.util.matchUserAgent('MSIE'); 45 | }; 46 | 47 | 48 | /** 49 | * @return {boolean} Whether the rendering engine is Edge. 50 | */ 51 | goog.labs.userAgent.engine.isEdge = function() { 52 | return goog.labs.userAgent.util.matchUserAgent('Edge'); 53 | }; 54 | 55 | 56 | /** 57 | * @return {boolean} Whether the rendering engine is WebKit. 58 | */ 59 | goog.labs.userAgent.engine.isWebKit = function() { 60 | return goog.labs.userAgent.util.matchUserAgentIgnoreCase('WebKit') && 61 | !goog.labs.userAgent.engine.isEdge(); 62 | }; 63 | 64 | 65 | /** 66 | * @return {boolean} Whether the rendering engine is Gecko. 67 | */ 68 | goog.labs.userAgent.engine.isGecko = function() { 69 | return goog.labs.userAgent.util.matchUserAgent('Gecko') && 70 | !goog.labs.userAgent.engine.isWebKit() && 71 | !goog.labs.userAgent.engine.isTrident() && 72 | !goog.labs.userAgent.engine.isEdge(); 73 | }; 74 | 75 | 76 | /** 77 | * @return {string} The rendering engine's version or empty string if version 78 | * can't be determined. 79 | */ 80 | goog.labs.userAgent.engine.getVersion = function() { 81 | var userAgentString = goog.labs.userAgent.util.getUserAgent(); 82 | if (userAgentString) { 83 | var tuples = goog.labs.userAgent.util.extractVersionTuples(userAgentString); 84 | 85 | var engineTuple = goog.labs.userAgent.engine.getEngineTuple_(tuples); 86 | if (engineTuple) { 87 | // In Gecko, the version string is either in the browser info or the 88 | // Firefox version. See Gecko user agent string reference: 89 | // http://goo.gl/mULqa 90 | if (engineTuple[0] == 'Gecko') { 91 | return goog.labs.userAgent.engine.getVersionForKey_(tuples, 'Firefox'); 92 | } 93 | 94 | return engineTuple[1]; 95 | } 96 | 97 | // MSIE has only one version identifier, and the Trident version is 98 | // specified in the parenthetical. IE Edge is covered in the engine tuple 99 | // detection. 100 | var browserTuple = tuples[0]; 101 | var info; 102 | if (browserTuple && (info = browserTuple[2])) { 103 | var match = /Trident\/([^\s;]+)/.exec(info); 104 | if (match) { 105 | return match[1]; 106 | } 107 | } 108 | } 109 | return ''; 110 | }; 111 | 112 | 113 | /** 114 | * @param {!Array>} tuples Extracted version tuples. 115 | * @return {!Array|undefined} The engine tuple or undefined if not 116 | * found. 117 | * @private 118 | */ 119 | goog.labs.userAgent.engine.getEngineTuple_ = function(tuples) { 120 | if (!goog.labs.userAgent.engine.isEdge()) { 121 | return tuples[1]; 122 | } 123 | for (var i = 0; i < tuples.length; i++) { 124 | var tuple = tuples[i]; 125 | if (tuple[0] == 'Edge') { 126 | return tuple; 127 | } 128 | } 129 | }; 130 | 131 | 132 | /** 133 | * @param {string|number} version The version to check. 134 | * @return {boolean} Whether the rendering engine version is higher or the same 135 | * as the given version. 136 | */ 137 | goog.labs.userAgent.engine.isVersionOrHigher = function(version) { 138 | return goog.string.compareVersions( 139 | goog.labs.userAgent.engine.getVersion(), version) >= 0; 140 | }; 141 | 142 | 143 | /** 144 | * @param {!Array>} tuples Version tuples. 145 | * @param {string} key The key to look for. 146 | * @return {string} The version string of the given key, if present. 147 | * Otherwise, the empty string. 148 | * @private 149 | */ 150 | goog.labs.userAgent.engine.getVersionForKey_ = function(tuples, key) { 151 | // TODO(nnaze): Move to util if useful elsewhere. 152 | 153 | var pair = goog.array.find(tuples, function(pair) { return key == pair[0]; }); 154 | 155 | return pair && pair[1] || ''; 156 | }; 157 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/labs/useragent/platform.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Closure user agent platform detection. 17 | * @see User agent strings 18 | * For more information on browser brand, rendering engine, or device see the 19 | * other sub-namespaces in goog.labs.userAgent (browser, engine, and device 20 | * respectively). 21 | * 22 | */ 23 | 24 | goog.provide('goog.labs.userAgent.platform'); 25 | 26 | goog.require('goog.labs.userAgent.util'); 27 | goog.require('goog.string'); 28 | 29 | 30 | /** 31 | * @return {boolean} Whether the platform is Android. 32 | */ 33 | goog.labs.userAgent.platform.isAndroid = function() { 34 | return goog.labs.userAgent.util.matchUserAgent('Android'); 35 | }; 36 | 37 | 38 | /** 39 | * @return {boolean} Whether the platform is iPod. 40 | */ 41 | goog.labs.userAgent.platform.isIpod = function() { 42 | return goog.labs.userAgent.util.matchUserAgent('iPod'); 43 | }; 44 | 45 | 46 | /** 47 | * @return {boolean} Whether the platform is iPhone. 48 | */ 49 | goog.labs.userAgent.platform.isIphone = function() { 50 | return goog.labs.userAgent.util.matchUserAgent('iPhone') && 51 | !goog.labs.userAgent.util.matchUserAgent('iPod') && 52 | !goog.labs.userAgent.util.matchUserAgent('iPad'); 53 | }; 54 | 55 | 56 | /** 57 | * @return {boolean} Whether the platform is iPad. 58 | */ 59 | goog.labs.userAgent.platform.isIpad = function() { 60 | return goog.labs.userAgent.util.matchUserAgent('iPad'); 61 | }; 62 | 63 | 64 | /** 65 | * @return {boolean} Whether the platform is iOS. 66 | */ 67 | goog.labs.userAgent.platform.isIos = function() { 68 | return goog.labs.userAgent.platform.isIphone() || 69 | goog.labs.userAgent.platform.isIpad() || 70 | goog.labs.userAgent.platform.isIpod(); 71 | }; 72 | 73 | 74 | /** 75 | * @return {boolean} Whether the platform is Mac. 76 | */ 77 | goog.labs.userAgent.platform.isMacintosh = function() { 78 | return goog.labs.userAgent.util.matchUserAgent('Macintosh'); 79 | }; 80 | 81 | 82 | /** 83 | * Note: ChromeOS is not considered to be Linux as it does not report itself 84 | * as Linux in the user agent string. 85 | * @return {boolean} Whether the platform is Linux. 86 | */ 87 | goog.labs.userAgent.platform.isLinux = function() { 88 | return goog.labs.userAgent.util.matchUserAgent('Linux'); 89 | }; 90 | 91 | 92 | /** 93 | * @return {boolean} Whether the platform is Windows. 94 | */ 95 | goog.labs.userAgent.platform.isWindows = function() { 96 | return goog.labs.userAgent.util.matchUserAgent('Windows'); 97 | }; 98 | 99 | 100 | /** 101 | * @return {boolean} Whether the platform is ChromeOS. 102 | */ 103 | goog.labs.userAgent.platform.isChromeOS = function() { 104 | return goog.labs.userAgent.util.matchUserAgent('CrOS'); 105 | }; 106 | 107 | 108 | /** 109 | * The version of the platform. We only determine the version for Windows, 110 | * Mac, and Chrome OS. It doesn't make much sense on Linux. For Windows, we only 111 | * look at the NT version. Non-NT-based versions (e.g. 95, 98, etc.) are given 112 | * version 0.0. 113 | * 114 | * @return {string} The platform version or empty string if version cannot be 115 | * determined. 116 | */ 117 | goog.labs.userAgent.platform.getVersion = function() { 118 | var userAgentString = goog.labs.userAgent.util.getUserAgent(); 119 | var version = '', re; 120 | if (goog.labs.userAgent.platform.isWindows()) { 121 | re = /Windows (?:NT|Phone) ([0-9.]+)/; 122 | var match = re.exec(userAgentString); 123 | if (match) { 124 | version = match[1]; 125 | } else { 126 | version = '0.0'; 127 | } 128 | } else if (goog.labs.userAgent.platform.isIos()) { 129 | re = /(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/; 130 | var match = re.exec(userAgentString); 131 | // Report the version as x.y.z and not x_y_z 132 | version = match && match[1].replace(/_/g, '.'); 133 | } else if (goog.labs.userAgent.platform.isMacintosh()) { 134 | re = /Mac OS X ([0-9_.]+)/; 135 | var match = re.exec(userAgentString); 136 | // Note: some old versions of Camino do not report an OSX version. 137 | // Default to 10. 138 | version = match ? match[1].replace(/_/g, '.') : '10'; 139 | } else if (goog.labs.userAgent.platform.isAndroid()) { 140 | re = /Android\s+([^\);]+)(\)|;)/; 141 | var match = re.exec(userAgentString); 142 | version = match && match[1]; 143 | } else if (goog.labs.userAgent.platform.isChromeOS()) { 144 | re = /(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/; 145 | var match = re.exec(userAgentString); 146 | version = match && match[1]; 147 | } 148 | return version || ''; 149 | }; 150 | 151 | 152 | /** 153 | * @param {string|number} version The version to check. 154 | * @return {boolean} Whether the browser version is higher or the same as the 155 | * given version. 156 | */ 157 | goog.labs.userAgent.platform.isVersionOrHigher = function(version) { 158 | return goog.string.compareVersions( 159 | goog.labs.userAgent.platform.getVersion(), version) >= 0; 160 | }; 161 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/labs/useragent/util.js: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Utilities used by goog.labs.userAgent tools. These functions 17 | * should not be used outside of goog.labs.userAgent.*. 18 | * 19 | * 20 | * @author nnaze@google.com (Nathan Naze) 21 | */ 22 | 23 | goog.provide('goog.labs.userAgent.util'); 24 | 25 | goog.require('goog.string'); 26 | 27 | 28 | /** 29 | * Gets the native userAgent string from navigator if it exists. 30 | * If navigator or navigator.userAgent string is missing, returns an empty 31 | * string. 32 | * @return {string} 33 | * @private 34 | */ 35 | goog.labs.userAgent.util.getNativeUserAgentString_ = function() { 36 | var navigator = goog.labs.userAgent.util.getNavigator_(); 37 | if (navigator) { 38 | var userAgent = navigator.userAgent; 39 | if (userAgent) { 40 | return userAgent; 41 | } 42 | } 43 | return ''; 44 | }; 45 | 46 | 47 | /** 48 | * Getter for the native navigator. 49 | * This is a separate function so it can be stubbed out in testing. 50 | * @return {Navigator} 51 | * @private 52 | */ 53 | goog.labs.userAgent.util.getNavigator_ = function() { 54 | return goog.global.navigator; 55 | }; 56 | 57 | 58 | /** 59 | * A possible override for applications which wish to not check 60 | * navigator.userAgent but use a specified value for detection instead. 61 | * @private {string} 62 | */ 63 | goog.labs.userAgent.util.userAgent_ = 64 | goog.labs.userAgent.util.getNativeUserAgentString_(); 65 | 66 | 67 | /** 68 | * Applications may override browser detection on the built in 69 | * navigator.userAgent object by setting this string. Set to null to use the 70 | * browser object instead. 71 | * @param {?string=} opt_userAgent The User-Agent override. 72 | */ 73 | goog.labs.userAgent.util.setUserAgent = function(opt_userAgent) { 74 | goog.labs.userAgent.util.userAgent_ = 75 | opt_userAgent || goog.labs.userAgent.util.getNativeUserAgentString_(); 76 | }; 77 | 78 | 79 | /** 80 | * @return {string} The user agent string. 81 | */ 82 | goog.labs.userAgent.util.getUserAgent = function() { 83 | return goog.labs.userAgent.util.userAgent_; 84 | }; 85 | 86 | 87 | /** 88 | * @param {string} str 89 | * @return {boolean} Whether the user agent contains the given string. 90 | */ 91 | goog.labs.userAgent.util.matchUserAgent = function(str) { 92 | var userAgent = goog.labs.userAgent.util.getUserAgent(); 93 | return goog.string.contains(userAgent, str); 94 | }; 95 | 96 | 97 | /** 98 | * @param {string} str 99 | * @return {boolean} Whether the user agent contains the given string, ignoring 100 | * case. 101 | */ 102 | goog.labs.userAgent.util.matchUserAgentIgnoreCase = function(str) { 103 | var userAgent = goog.labs.userAgent.util.getUserAgent(); 104 | return goog.string.caseInsensitiveContains(userAgent, str); 105 | }; 106 | 107 | 108 | /** 109 | * Parses the user agent into tuples for each section. 110 | * @param {string} userAgent 111 | * @return {!Array>} Tuples of key, version, and the contents 112 | * of the parenthetical. 113 | */ 114 | goog.labs.userAgent.util.extractVersionTuples = function(userAgent) { 115 | // Matches each section of a user agent string. 116 | // Example UA: 117 | // Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) 118 | // AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405 119 | // This has three version tuples: Mozilla, AppleWebKit, and Mobile. 120 | 121 | var versionRegExp = new RegExp( 122 | // Key. Note that a key may have a space. 123 | // (i.e. 'Mobile Safari' in 'Mobile Safari/5.0') 124 | '(\\w[\\w ]+)' + 125 | 126 | '/' + // slash 127 | '([^\\s]+)' + // version (i.e. '5.0b') 128 | '\\s*' + // whitespace 129 | '(?:\\((.*?)\\))?', // parenthetical info. parentheses not matched. 130 | 'g'); 131 | 132 | var data = []; 133 | var match; 134 | 135 | // Iterate and collect the version tuples. Each iteration will be the 136 | // next regex match. 137 | while (match = versionRegExp.exec(userAgent)) { 138 | data.push([ 139 | match[1], // key 140 | match[2], // value 141 | // || undefined as this is not undefined in IE7 and IE8 142 | match[3] || undefined // info 143 | ]); 144 | } 145 | 146 | return data; 147 | }; 148 | -------------------------------------------------------------------------------- /AJC-bin/cpp-wasm/library/closure/goog/reflect/reflect.js: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Closure Library Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @fileoverview Useful compiler idioms. 17 | * 18 | * @author johnlenz@google.com (John Lenz) 19 | */ 20 | 21 | goog.provide('goog.reflect'); 22 | 23 | 24 | /** 25 | * Syntax for object literal casts. 26 | * @see http://go/jscompiler-renaming 27 | * @see https://goo.gl/CRs09P 28 | * 29 | * Use this if you have an object literal whose keys need to have the same names 30 | * as the properties of some class even after they are renamed by the compiler. 31 | * 32 | * @param {!Function} type Type to cast to. 33 | * @param {Object} object Object literal to cast. 34 | * @return {Object} The object literal. 35 | */ 36 | goog.reflect.object = function(type, object) { 37 | return object; 38 | }; 39 | 40 | /** 41 | * Syntax for renaming property strings. 42 | * @see http://go/jscompiler-renaming 43 | * @see https://goo.gl/CRs09P 44 | * 45 | * Use this if you have an need to access a property as a string, but want 46 | * to also have the property renamed by the compiler. In contrast to 47 | * goog.reflect.object, this method takes an instance of an object. 48 | * 49 | * Properties must be simple names (not qualified names). 50 | * 51 | * @param {string} prop Name of the property 52 | * @param {!Object} object Instance of the object whose type will be used 53 | * for renaming 54 | * @return {string} The renamed property. 55 | */ 56 | goog.reflect.objectProperty = function(prop, object) { 57 | return prop; 58 | }; 59 | 60 | /** 61 | * To assert to the compiler that an operation is needed when it would 62 | * otherwise be stripped. For example: 63 | * 64 | * // Force a layout 65 | * goog.reflect.sinkValue(dialog.offsetHeight); 66 | * 67 | * @param {T} x 68 | * @return {T} 69 | * @template T 70 | */ 71 | goog.reflect.sinkValue = function(x) { 72 | goog.reflect.sinkValue[' '](x); 73 | return x; 74 | }; 75 | 76 | 77 | /** 78 | * The compiler should optimize this function away iff no one ever uses 79 | * goog.reflect.sinkValue. 80 | */ 81 | goog.reflect.sinkValue[' '] = goog.nullFunction; 82 | 83 | 84 | /** 85 | * Check if a property can be accessed without throwing an exception. 86 | * @param {Object} obj The owner of the property. 87 | * @param {string} prop The property name. 88 | * @return {boolean} Whether the property is accessible. Will also return true 89 | * if obj is null. 90 | */ 91 | goog.reflect.canAccessProperty = function(obj, prop) { 92 | 93 | try { 94 | goog.reflect.sinkValue(obj[prop]); 95 | return true; 96 | } catch (e) { 97 | } 98 | return false; 99 | }; 100 | 101 | 102 | /** 103 | * Retrieves a value from a cache given a key. The compiler provides special 104 | * consideration for this call such that it is generally considered side-effect 105 | * free. However, if the {@code opt_keyFn} or {@code valueFn} have side-effects 106 | * then the entire call is considered to have side-effects. 107 | * 108 | * Conventionally storing the value on the cache would be considered a 109 | * side-effect and preclude unused calls from being pruned, ie. even if 110 | * the value was never used, it would still always be stored in the cache. 111 | * 112 | * Providing a side-effect free {@code valueFn} and {@code opt_keyFn} 113 | * allows unused calls to {@code goog.reflect.cache} to be pruned. 114 | * 115 | * @param {!Object} cacheObj The object that contains the cached values. 116 | * @param {?} key The key to lookup in the cache. If it is not string or number 117 | * then a {@code opt_keyFn} should be provided. The key is also used as the 118 | * parameter to the {@code valueFn}. 119 | * @param {function(?):V} valueFn The value provider to use to calculate the 120 | * value to store in the cache. This function should be side-effect free 121 | * to take advantage of the optimization. 122 | * @param {function(?):K=} opt_keyFn The key provider to determine the cache 123 | * map key. This should be used if the given key is not a string or number. 124 | * If not provided then the given key is used. This function should be 125 | * side-effect free to take advantage of the optimization. 126 | * @return {V} The cached or calculated value. 127 | * @template K 128 | * @template V 129 | */ 130 | goog.reflect.cache = function(cacheObj, key, valueFn, opt_keyFn) { 131 | var storedKey = opt_keyFn ? opt_keyFn(key) : key; 132 | 133 | if (Object.prototype.hasOwnProperty.call(cacheObj, storedKey)) { 134 | return cacheObj[storedKey]; 135 | } 136 | 137 | return (cacheObj[storedKey] = valueFn(key)); 138 | }; 139 | -------------------------------------------------------------------------------- /AJC-bin/win-vc140/Test_BunnyMark.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/AJC-bin/win-vc140/Test_BunnyMark.exe -------------------------------------------------------------------------------- /AJC-bin/win-vc140/assets/skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/AJC-bin/win-vc140/assets/skin.png -------------------------------------------------------------------------------- /AJC-bin/win-vc140/start-bunnyMark.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | pushd %~dp0 3 | call Test_BunnyMark -numBunnies 20000 4 | popd -------------------------------------------------------------------------------- /AJC-code/as3/ajc-asjs-sdk.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/AJC-code/as3/ajc-asjs-sdk.zip -------------------------------------------------------------------------------- /AJC-code/as3/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /AJC-code/as3/config/as3-mxmlc-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | COMPILE::SWF 6 | true 7 | 8 | 9 | COMPILE::JS 10 | false 11 | 12 | 13 | 14 | ../src 15 | 16 | 17 | 18 | 19 | src/Test_BunnyMark.as 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /AJC-code/as3/config/js-mxmlc-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | COMPILE::SWF 7 | false 8 | 9 | 10 | COMPILE::JS 11 | true 12 | 13 | 14 | 15 | ..\src 16 | 17 | 18 | ..\libs\ajcFlash.swc 19 | 20 | 21 | 22 | 23 | src\Test_BunnyMark.as 24 | 25 | 26 | -------------------------------------------------------------------------------- /AJC-code/as3/config/test-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | true 7 | 8 | 9 | CONFIG::debug 10 | true 11 | 12 | 13 | CONFIG::release 14 | false 15 | 16 | 17 | CONFIG::timeStamp 18 | '12/29/2017' 19 | 20 | 21 | COMPILE::SWF 22 | false 23 | 24 | 25 | COMPILE::JS 26 | true 27 | 28 | false 29 | false 30 | true 31 | true 32 | true 33 | true 34 | true 35 | true 36 | true 37 | 38 | D:\AJC\ajc-cpp\ajc-oryol\ajc-runtime-web\as3\src 39 | 40 | 41 | D:\AJC\ajc-cpp\ajc-oryol\ajc-runtime-web\as3\libs\bin\ajcFlash.swc 42 | D:\AJC\ajc-asjs\ide\flashdevelop\FlashDevelop\Bin\Debug\ajc-asjs-sdk\frameworks\js\1.0\libs-header\js-global.swc 43 | 44 | 45 | D:\AJC\ajc-asjs\ide\flashdevelop\FlashDevelop\Bin\Debug\ajc-asjs-sdk\frameworks\js\1.0\libs-library\as3-intrinsic.swc 46 | 47 | 48 | 49 | D:\AJC\ajc-cpp\ajc-oryol\ajc-runtime-web\as3\src\Test_BunnyMark.as 50 | 51 | -------------------------------------------------------------------------------- /AJC-code/as3/files/AjcRuntimeWeb.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/AJC-code/as3/files/AjcRuntimeWeb.wasm -------------------------------------------------------------------------------- /AJC-code/as3/files/assets/skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/AJC-code/as3/files/assets/skin.png -------------------------------------------------------------------------------- /AJC-code/as3/libs/ajcFlash.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/AJC-code/as3/libs/ajcFlash.swc -------------------------------------------------------------------------------- /AJC-code/as3/src/Test_BunnyMark.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | import bunnyMark.BackGround; 4 | import bunnyMark.BunnyTileTest; 5 | import flash.display.Sprite; 6 | import flash.events.Event; 7 | 8 | 9 | /** 10 | * ... 11 | * @author Jason Huang 12 | */ 13 | public class Test_BunnyMark extends Sprite 14 | { 15 | /** 16 | * @usage this is used for configing emsc module. 17 | * 18 | * 19 | * 32 | * 33 | */ 34 | public function Test_BunnyMark() 35 | { 36 | if (stage) 37 | init(null); 38 | else 39 | addEventListener(Event.ADDED_TO_STAGE, init, false, 0, false); 40 | } 41 | 42 | private function init(e:Event):void 43 | { 44 | removeEventListener(Event.ADDED_TO_STAGE, init, false); 45 | 46 | addChild(new BackGround()); 47 | addChild(new BunnyTileTest(5000)); 48 | } 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /AJC-code/as3/src/bunnyMark/BackGround.as: -------------------------------------------------------------------------------- 1 | package bunnyMark 2 | { 3 | import flash.display.Bitmap; 4 | import flash.display.BitmapData; 5 | import flash.display.Sprite; 6 | import flash.events.Event; 7 | import flash.utils.getTimer; 8 | /** 9 | * ... 10 | * @author Jason Huang 11 | */ 12 | public class BackGround extends Sprite 13 | { 14 | private var m_tileWidth:int; 15 | private var m_tileHeight:int; 16 | private var m_bitmap:Bitmap; 17 | 18 | public function BackGround() 19 | { 20 | if (stage) 21 | init(null); 22 | else 23 | addEventListener(Event.ADDED_TO_STAGE, init, false, 0, false); 24 | } 25 | 26 | private function init(event:Event): void 27 | { 28 | removeEventListener(Event.ADDED_TO_STAGE, init, false); 29 | 30 | 31 | m_tileWidth = 64; 32 | m_tileHeight = 64; 33 | 34 | var bitmapData:BitmapData = new BitmapData(m_tileWidth, m_tileHeight, false, 0xff000000); 35 | m_bitmap = new Bitmap(bitmapData); 36 | m_bitmap.scaleX = stage.stageWidth / m_tileWidth; 37 | m_bitmap.scaleY = stage.stageHeight / m_tileHeight; 38 | 39 | addChild(m_bitmap); 40 | 41 | stage.addEventListener(Event.RESIZE, stageResizeHandler, false, 0, false); 42 | stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, false); 43 | 44 | addEventListener(Event.REMOVED_FROM_STAGE, removed, false, 0, false); 45 | } 46 | private function removed(event:Event): void 47 | { 48 | removeEventListener(Event.REMOVED_FROM_STAGE, removed, false); 49 | 50 | removeChild(m_bitmap); 51 | 52 | stage.removeEventListener(Event.RESIZE, stageResizeHandler, false); 53 | stage.removeEventListener(Event.ENTER_FRAME, enterFrameHandler, false); 54 | } 55 | private function stageResizeHandler(event:Event): void 56 | { 57 | m_bitmap.scaleX = stage.stageWidth / m_tileWidth; 58 | m_bitmap.scaleY = stage.stageHeight / m_tileHeight; 59 | } 60 | private function enterFrameHandler(event:Event): void 61 | { 62 | var t:int = getTimer() / 400.0; 63 | 64 | var scale:Number = 4.0; 65 | var wave:Number = Math.PI * 6.0 / Number(m_tileHeight); 66 | 67 | for (var x:int = 0; x < m_tileWidth; x++) 68 | { 69 | for (var y:int = 0; y < m_tileHeight; y++) 70 | { 71 | var offsetY:Number = Math.sin(x * wave / 20.0 + t) * 30.0 + Math.sin(x * wave / 5.0 + t * 2) * 5.0; 72 | var offsetX:Number = (2.0 + Math.sin((y + offsetY) * wave + t) + Math.sin((y + offsetY) * wave * 0.7 + t * 2.4)) / 4.0; 73 | 74 | var bitmapData :BitmapData = m_bitmap.bitmapData; 75 | bitmapData.setPixel(x, y, uint(255 * offsetX)); 76 | 77 | COMPILE::JS 78 | { 79 | bitmapData.emsc_delete(); 80 | } 81 | } 82 | } 83 | } 84 | 85 | } 86 | } -------------------------------------------------------------------------------- /AJC-code/as3/src/bunnyMark/Bunny.as: -------------------------------------------------------------------------------- 1 | package bunnyMark 2 | { 3 | import flash.display.Bitmap; 4 | import flash.display.BitmapData; 5 | 6 | /** 7 | * ... 8 | * @author Joshua Granick 9 | */ 10 | public class Bunny extends Bitmap 11 | { 12 | public var speedX:Number; 13 | public var speedY:Number; 14 | 15 | public function Bunny(bitmapData:BitmapData) 16 | { 17 | super(bitmapData); 18 | speedX = 0; 19 | speedY = 0; 20 | } 21 | 22 | } 23 | } -------------------------------------------------------------------------------- /AJC-code/as3/src/bunnyMark/BunnyTileTest.as: -------------------------------------------------------------------------------- 1 | package bunnyMark 2 | { 3 | import flash.display.Bitmap; 4 | import flash.display.BitmapData; 5 | import flash.display.Loader; 6 | import flash.display.LoaderInfo; 7 | import flash.display.Sprite; 8 | import flash.events.Event; 9 | import flash.events.MouseEvent; 10 | import flash.net.URLRequest; 11 | 12 | /** 13 | * @author Joshua Granick 14 | * @author Philippe Elsass 15 | */ 16 | public class BunnyTileTest extends Sprite 17 | { 18 | private var m_maxX:int; 19 | private var m_maxY:int; 20 | private var m_minX:int; 21 | private var m_minY:int; 22 | private var m_gravity:Number; 23 | private var m_numBunnies:int; 24 | private var m_numBunniesIncrease:int; 25 | 26 | private var m_bunnies_vector:Vector.; 27 | private var m_bunnyBitmapData:BitmapData; 28 | 29 | 30 | public function BunnyTileTest(numBunnies:uint) 31 | { 32 | m_numBunniesIncrease = numBunnies; 33 | if (stage) 34 | init(null); 35 | else 36 | addEventListener(Event.ADDED_TO_STAGE, init); 37 | } 38 | private function init(e:Event):void 39 | { 40 | removeEventListener(Event.ADDED_TO_STAGE, init); 41 | 42 | m_gravity = 0.5; 43 | m_minX = m_minY = m_numBunnies= 0; 44 | 45 | m_bunnyBitmapData = new BitmapData(26, 37,true, 0xff000000); 46 | m_bunnies_vector = new Vector.(); 47 | 48 | var loader:Loader = new Loader(); 49 | loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompleteHandler); 50 | loader.load(new URLRequest("./assets/skin.png")); 51 | 52 | stageResizeHandler(null); 53 | stageClickHandler(null); 54 | 55 | stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler); 56 | stage.addEventListener(Event.RESIZE, stageResizeHandler); 57 | stage.addEventListener(MouseEvent.CLICK, stageClickHandler); 58 | 59 | } 60 | 61 | private function loaderCompleteHandler(e:Event):void 62 | { 63 | e.target.removeEventListener(Event.COMPLETE, loaderCompleteHandler); 64 | 65 | var loaderInfo:LoaderInfo = e.target as LoaderInfo; 66 | 67 | var bitmap:Bitmap = loaderInfo.content as Bitmap; 68 | 69 | m_bunnyBitmapData = bitmap.bitmapData; 70 | 71 | for (var i:int = 0; i < m_numBunnies; i++ ) 72 | { 73 | var bunny:Bunny = m_bunnies_vector[i]; 74 | if (bunny) 75 | bunny.bitmapData = m_bunnyBitmapData; 76 | } 77 | } 78 | 79 | private function enterFrameHandler(e:Event) :void 80 | { 81 | for (var i:int = 0; i < m_numBunnies; i++ ) 82 | { 83 | var bunny:Bunny = m_bunnies_vector[i]; 84 | bunny.x += bunny.speedX; 85 | bunny.y += bunny.speedY; 86 | bunny.speedY += m_gravity; 87 | 88 | if (bunny.x > m_maxX) 89 | { 90 | bunny.speedX *= -1.0; 91 | bunny.x = m_maxX; 92 | } 93 | else if (bunny.x < m_minX) 94 | { 95 | bunny.speedX *= -1.0; 96 | bunny.x = m_minX; 97 | } 98 | if (bunny.y > m_maxY) 99 | { 100 | bunny.speedY *= -0.8; 101 | bunny.y = m_maxY; 102 | 103 | if (Math.random() > 0.5) bunny.speedY -= 3 + Math.random() * 4; 104 | } 105 | else if (bunny.y < m_minY) 106 | { 107 | bunny.speedY = 0; 108 | bunny.y = m_minY; 109 | } 110 | } 111 | } 112 | 113 | private function stageResizeHandler(e:Event) :void 114 | { 115 | m_maxX = stage.stageWidth; 116 | m_maxY = stage.stageHeight; 117 | } 118 | 119 | public function stageClickHandler(e:Event):void 120 | { 121 | m_numBunnies += m_numBunniesIncrease; 122 | 123 | for (var i :int = 0; i < m_numBunniesIncrease; i++ ) 124 | { 125 | var bunny:Bunny = new Bunny(m_bunnyBitmapData); 126 | 127 | bunny.speedX = Math.random() * 5.0; 128 | bunny.speedY = Math.random() * 5.0 - 2.5; 129 | 130 | var scaleRand:Number = 0.3 + Math.random(); 131 | bunny.scaleX = scaleRand; 132 | bunny.scaleY = scaleRand; 133 | 134 | bunny.rotation = 120.0 * (15.0 - Math.random() * 30.0); 135 | 136 | addChild(bunny); 137 | m_bunnies_vector.push(bunny); 138 | } 139 | 140 | } 141 | } 142 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 JasonH 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AJC-Flash-WebAssembly-Examples 2 | AJC stands for AnyScripts JavaScript C++. 3 | (This project has been suspended on May 2018) 4 | 5 | ## What and Why? 6 | As [Adobe has announced](http://blogs.adobe.com/conversations/2017/07/adobe-flash-update.html) it will stop distributing and updating Flash Player at the end of 2020, we believe Flash API is very powerful for delivering rich media contents, and it may serve much more than just web applications. So we decided to build a c++ version of Flash API and using WebAssembly for targeting to web platforms, which contains most of the [Flash API](https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/). 7 | 8 | The reason of doing this is because we love flash and also we wanna provide an efficient-fast-safe c++ version of Flash API for not only As3 language, but also for Java Script and Type Script ( we may consider JAVA and C# in the future).So they are able to natively run on web platform just like what flash player did. 9 | As we use c++ to develop the entire API, it could be also used as a high-level rich media c++ API for cross-platform developing, such as Windows, OSX, IOS, Android, etc. 10 | 11 | ## How? 12 | For supporting scripting languages, using a stable transpiler to compile them to JavaScript, and use compiled Java Script to interact with compiled WebAssembly. 13 | 14 | For example, our As3 approach is using a customized [FalconJX Compiler](https://cwiki.apache.org/confluence/display/FLEX/Getting+Started+with+the+Falcon+and+FalconJX+Compilers) to compile all As3 source codes into Java Script while using an external-library(similar with .d.ts in Type Script or .h with no definitions in c++ ) to provide declarations for those class/function that implemented in c++ side.(this step is very similar with compiling type script to Java Script) 15 | Then, we load compiled wasm into web browser to provide Flash API for runtime environment, and simulating As3 inheritance and any other As3 intrinsic language features after initializing wasm. 16 | Therefore, currently it runs exactly the same as original As3 with flash player. 17 | 18 | ## Present 19 | After few months hard working, we have: 20 | * A sdk suit for building AS3-JavaScript. 21 | * A customized Flash-Develop code IDE to develop As3 projects for targeting both flash player and java script, including debugger using [Java Script source maps](https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Use_a_source_map) and interacting with chrome remote interface. So you may debug your Java Script files that compiled from original As3 files as exactly the same as you compile them to target original flash player. 22 | * A customized embind for emscripten. 23 | * An initial state of Flash API coding in c++, currently supports display list, event flow, efficient gpu 2d renderer, basic data structures, etc. 24 | 25 | ## Demo 26 | AJC-bin contains serveral demos below: 27 | ### [cpp-wasm](https://jasonhuang3d.github.io/WebAssembly-Examples/AJC-bin/cpp-wasm/) 28 | In this folder, we wrote the As3 source codes the previous demo used into c++ side, because we have the same flash API in c++ side, so the bunnyMark c++ source code looks almost the same as As3 one. Even with coding styles:) 29 | Basically we are using only wasm, but used same flash API as previous demo used. You may change the number of bunnies by changing Test_BunnyMark_Native.js line:39. 30 | 31 | ### [as3-js-wasm](https://jasonhuang3d.github.io/WebAssembly-Examples/AJC-bin/as-js-wasm/) 32 | In this folder, we compiled As3 source codes to corresponding Java Scripts, then using compiled Java Scripts to use wasm that contains flash api. 33 | Basically we are using As3 and Flash API with wasm. You may change the number of bunnies by source codes provided in AJC-code, or just modify the value inside of Test_BunnyMark.js line:56. 34 | 35 | ### win-vc140 36 | In this folder, we used the same source codes with previous cpp-wasm demo to compile to windows native platform with -OX optimized level. You may change the number of bunnies by passing -numBunnies cmd arg. 37 | 38 | ## Source 39 | AJC-code contains the full As3 source codes in order to build the bunnyMark demo. 40 | in order to build, you may need [Apache Ant](https://ant.apache.org/bindownload.cgi). Simply unzip the ajc-asjs-sdk.zip, and call ant in the root of the As3 source folder, will use same As3 source codes to build to both original flash player and java script that interacting with wasm. 41 | ![C++ codes](images/code-style-cpp.png) 42 | ![As3 codes](images/code-style-as3.png) 43 | 44 | ## Debug 45 | I implemented a chrome-remote-debug protocol in Flash-Develop IDE, now debugging compiled JS with AS3 source code in Flash-Develop IDE is not a problem anymore. 46 | ![Debugging in Flash-Develop](images/flashdevelop-debug-js.gif) 47 | 48 | 49 | ## Performance 50 | cpp-wasm is almost as fast as native win-vc140. However, as3-js-wasm is about 1.5 times slower than them, due to the cost of a huge number of times that interacting js with cpp side, the cost of writing and reading shared-heap-array is a bit overhead. 51 | We will be keep optimizing embind. if you have any suggestions, please let me know. 52 | 53 | ## What next? 54 | We will be mainly focusing on finishing our c++ Flash API as fast as we can, we all knew this is not an easy task to achieve. But we will never give up, cause we are someone just like you who loves Flash. 55 | We would truly appreciate any part of help from you. 56 | If you are interested in this project and willing to join us, please let me know. 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /images/code-style-as3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/images/code-style-as3.png -------------------------------------------------------------------------------- /images/code-style-cpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/images/code-style-cpp.png -------------------------------------------------------------------------------- /images/flashdevelop-debug-js.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasonHuang3D/WebAssembly-Examples/565f32d1a509858a5420146e63e7619dba0866b1/images/flashdevelop-debug-js.gif --------------------------------------------------------------------------------