From a0b32a783b657e5d03501061763d64db357dad06 Mon Sep 17 00:00:00 2001 From: klangner Date: Sat, 12 Sep 2020 15:49:33 +0200 Subject: [PATCH] First working version --- .gitignore | 3 +- demo/README.md | 2 + docs/0.bootstrap.js | 72 ++++++ docs/bootstrap.js | 315 ++++++++++++++++++++++++++ docs/f138b06b088ae74c6a29.module.wasm | Bin 0 -> 17489 bytes docs/index.html | 26 +-- docs/index.js | 199 ---------------- 7 files changed, 394 insertions(+), 223 deletions(-) create mode 100644 docs/0.bootstrap.js create mode 100644 docs/bootstrap.js create mode 100644 docs/f138b06b088ae74c6a29.module.wasm delete mode 100644 docs/index.js diff --git a/.gitignore b/.gitignore index f94e817..39266be 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /demo/target Cargo.lock .vscode/ -pkg/ \ No newline at end of file +pkg/ +package-lock.json \ No newline at end of file diff --git a/demo/README.md b/demo/README.md index 4f2b82a..d9669b8 100644 --- a/demo/README.md +++ b/demo/README.md @@ -4,6 +4,8 @@ ``` wasm-pack build +cd www +npm run build ``` This app uses: diff --git a/docs/0.bootstrap.js b/docs/0.bootstrap.js new file mode 100644 index 0000000..af1b577 --- /dev/null +++ b/docs/0.bootstrap.js @@ -0,0 +1,72 @@ +(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[0],{ + +/***/ "../pkg/mapgen_demo.js": +/*!*****************************!*\ + !*** ../pkg/mapgen_demo.js ***! + \*****************************/ +/*! exports provided: main, add, __wbindgen_object_drop_ref, __wbg_instanceof_Window_adf3196bdc02b386, __wbg_document_6cc8d0b87c0a99b9, __wbg_body_8c888fe47d81765f, __wbg_createElement_5bdf88a5af9f17c5, __wbg_setinnerHTML_4ff235db1a3cb4d8, __wbg_appendChild_77215fd672b162c5, __wbg_call_8e95613cc6524977, __wbindgen_object_clone_ref, __wbg_newnoargs_f3b8a801d5d4b079, __wbg_self_07b2f89e82ceb76d, __wbg_window_ba85d88572adc0dc, __wbg_globalThis_b9277fc37e201fe5, __wbg_global_e16303fe83e1d57f, __wbindgen_is_undefined, __wbindgen_throw, __wbindgen_rethrow */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _mapgen_demo_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mapgen_demo_bg.wasm */ \"../pkg/mapgen_demo_bg.wasm\");\n/* harmony import */ var _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mapgen_demo_bg.js */ \"../pkg/mapgen_demo_bg.js\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"main\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"main\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"add\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"add\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_object_drop_ref\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbindgen_object_drop_ref\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_instanceof_Window_adf3196bdc02b386\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_instanceof_Window_adf3196bdc02b386\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_document_6cc8d0b87c0a99b9\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_document_6cc8d0b87c0a99b9\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_body_8c888fe47d81765f\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_body_8c888fe47d81765f\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_createElement_5bdf88a5af9f17c5\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_createElement_5bdf88a5af9f17c5\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_setinnerHTML_4ff235db1a3cb4d8\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_setinnerHTML_4ff235db1a3cb4d8\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_appendChild_77215fd672b162c5\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_appendChild_77215fd672b162c5\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_call_8e95613cc6524977\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_call_8e95613cc6524977\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_object_clone_ref\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbindgen_object_clone_ref\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_newnoargs_f3b8a801d5d4b079\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_newnoargs_f3b8a801d5d4b079\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_self_07b2f89e82ceb76d\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_self_07b2f89e82ceb76d\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_window_ba85d88572adc0dc\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_window_ba85d88572adc0dc\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_globalThis_b9277fc37e201fe5\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_globalThis_b9277fc37e201fe5\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbg_global_e16303fe83e1d57f\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbg_global_e16303fe83e1d57f\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_is_undefined\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbindgen_is_undefined\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_throw\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbindgen_throw\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_rethrow\", function() { return _mapgen_demo_bg_js__WEBPACK_IMPORTED_MODULE_1__[\"__wbindgen_rethrow\"]; });\n\n\n\n_mapgen_demo_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_start\"]();\n\n\n//# sourceURL=webpack:///../pkg/mapgen_demo.js?"); + +/***/ }), + +/***/ "../pkg/mapgen_demo_bg.js": +/*!********************************!*\ + !*** ../pkg/mapgen_demo_bg.js ***! + \********************************/ +/*! exports provided: main, add, __wbindgen_object_drop_ref, __wbg_instanceof_Window_adf3196bdc02b386, __wbg_document_6cc8d0b87c0a99b9, __wbg_body_8c888fe47d81765f, __wbg_createElement_5bdf88a5af9f17c5, __wbg_setinnerHTML_4ff235db1a3cb4d8, __wbg_appendChild_77215fd672b162c5, __wbg_call_8e95613cc6524977, __wbindgen_object_clone_ref, __wbg_newnoargs_f3b8a801d5d4b079, __wbg_self_07b2f89e82ceb76d, __wbg_window_ba85d88572adc0dc, __wbg_globalThis_b9277fc37e201fe5, __wbg_global_e16303fe83e1d57f, __wbindgen_is_undefined, __wbindgen_throw, __wbindgen_rethrow */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(module, global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"main\", function() { return main; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"add\", function() { return add; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_object_drop_ref\", function() { return __wbindgen_object_drop_ref; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_instanceof_Window_adf3196bdc02b386\", function() { return __wbg_instanceof_Window_adf3196bdc02b386; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_document_6cc8d0b87c0a99b9\", function() { return __wbg_document_6cc8d0b87c0a99b9; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_body_8c888fe47d81765f\", function() { return __wbg_body_8c888fe47d81765f; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_createElement_5bdf88a5af9f17c5\", function() { return __wbg_createElement_5bdf88a5af9f17c5; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_setinnerHTML_4ff235db1a3cb4d8\", function() { return __wbg_setinnerHTML_4ff235db1a3cb4d8; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_appendChild_77215fd672b162c5\", function() { return __wbg_appendChild_77215fd672b162c5; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_call_8e95613cc6524977\", function() { return __wbg_call_8e95613cc6524977; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_object_clone_ref\", function() { return __wbindgen_object_clone_ref; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_newnoargs_f3b8a801d5d4b079\", function() { return __wbg_newnoargs_f3b8a801d5d4b079; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_self_07b2f89e82ceb76d\", function() { return __wbg_self_07b2f89e82ceb76d; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_window_ba85d88572adc0dc\", function() { return __wbg_window_ba85d88572adc0dc; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_globalThis_b9277fc37e201fe5\", function() { return __wbg_globalThis_b9277fc37e201fe5; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbg_global_e16303fe83e1d57f\", function() { return __wbg_global_e16303fe83e1d57f; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_is_undefined\", function() { return __wbindgen_is_undefined; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_throw\", function() { return __wbindgen_throw; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__wbindgen_rethrow\", function() { return __wbindgen_rethrow; });\n/* harmony import */ var _mapgen_demo_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mapgen_demo_bg.wasm */ \"../pkg/mapgen_demo_bg.wasm\");\n\n\nconst heap = new Array(32).fill(undefined);\n\nheap.push(undefined, null, true, false);\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap_next = heap.length;\n\nfunction dropObject(idx) {\n if (idx < 36) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nconst lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;\n\nlet cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n\ncachedTextDecoder.decode();\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== _mapgen_demo_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer) {\n cachegetUint8Memory0 = new Uint8Array(_mapgen_demo_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"memory\"].buffer);\n }\n return cachegetUint8Memory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));\n}\n/**\n*/\nfunction main() {\n _mapgen_demo_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"main\"]();\n}\n\n/**\n* @param {number} a\n* @param {number} b\n* @returns {number}\n*/\nfunction add(a, b) {\n var ret = _mapgen_demo_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"add\"](a, b);\n return ret >>> 0;\n}\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction handleError(f) {\n return function () {\n try {\n return f.apply(this, arguments);\n\n } catch (e) {\n _mapgen_demo_bg_wasm__WEBPACK_IMPORTED_MODULE_0__[\"__wbindgen_exn_store\"](addHeapObject(e));\n }\n };\n}\n\nconst __wbindgen_object_drop_ref = function(arg0) {\n takeObject(arg0);\n};\n\nconst __wbg_instanceof_Window_adf3196bdc02b386 = function(arg0) {\n var ret = getObject(arg0) instanceof Window;\n return ret;\n};\n\nconst __wbg_document_6cc8d0b87c0a99b9 = function(arg0) {\n var ret = getObject(arg0).document;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nconst __wbg_body_8c888fe47d81765f = function(arg0) {\n var ret = getObject(arg0).body;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n};\n\nconst __wbg_createElement_5bdf88a5af9f17c5 = handleError(function(arg0, arg1, arg2) {\n var ret = getObject(arg0).createElement(getStringFromWasm0(arg1, arg2));\n return addHeapObject(ret);\n});\n\nconst __wbg_setinnerHTML_4ff235db1a3cb4d8 = function(arg0, arg1, arg2) {\n getObject(arg0).innerHTML = getStringFromWasm0(arg1, arg2);\n};\n\nconst __wbg_appendChild_77215fd672b162c5 = handleError(function(arg0, arg1) {\n var ret = getObject(arg0).appendChild(getObject(arg1));\n return addHeapObject(ret);\n});\n\nconst __wbg_call_8e95613cc6524977 = handleError(function(arg0, arg1) {\n var ret = getObject(arg0).call(getObject(arg1));\n return addHeapObject(ret);\n});\n\nconst __wbindgen_object_clone_ref = function(arg0) {\n var ret = getObject(arg0);\n return addHeapObject(ret);\n};\n\nconst __wbg_newnoargs_f3b8a801d5d4b079 = function(arg0, arg1) {\n var ret = new Function(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n};\n\nconst __wbg_self_07b2f89e82ceb76d = handleError(function() {\n var ret = self.self;\n return addHeapObject(ret);\n});\n\nconst __wbg_window_ba85d88572adc0dc = handleError(function() {\n var ret = window.window;\n return addHeapObject(ret);\n});\n\nconst __wbg_globalThis_b9277fc37e201fe5 = handleError(function() {\n var ret = globalThis.globalThis;\n return addHeapObject(ret);\n});\n\nconst __wbg_global_e16303fe83e1d57f = handleError(function() {\n var ret = global.global;\n return addHeapObject(ret);\n});\n\nconst __wbindgen_is_undefined = function(arg0) {\n var ret = getObject(arg0) === undefined;\n return ret;\n};\n\nconst __wbindgen_throw = function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\nconst __wbindgen_rethrow = function(arg0) {\n throw takeObject(arg0);\n};\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../www/node_modules/webpack/buildin/harmony-module.js */ \"./node_modules/webpack/buildin/harmony-module.js\")(module), __webpack_require__(/*! ./../www/node_modules/webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///../pkg/mapgen_demo_bg.js?"); + +/***/ }), + +/***/ "../pkg/mapgen_demo_bg.wasm": +/*!**********************************!*\ + !*** ../pkg/mapgen_demo_bg.wasm ***! + \**********************************/ +/*! exports provided: memory, main, add, __wbindgen_exn_store, __wbindgen_start */ +/***/ (function(module, exports, __webpack_require__) { + +eval("\"use strict\";\n// Instantiate WebAssembly module\nvar wasmExports = __webpack_require__.w[module.i];\n__webpack_require__.r(exports);\n// export exports from WebAssembly module\nfor(var name in wasmExports) if(name != \"__webpack_init__\") exports[name] = wasmExports[name];\n// exec imports from WebAssembly module (for esm order)\n/* harmony import */ var m0 = __webpack_require__(/*! ./mapgen_demo_bg.js */ \"../pkg/mapgen_demo_bg.js\");\n\n\n// exec wasm module\nwasmExports[\"__webpack_init__\"]()\n\n//# sourceURL=webpack:///../pkg/mapgen_demo_bg.wasm?"); + +/***/ }), + +/***/ "./index.js": +/*!******************!*\ + !*** ./index.js ***! + \******************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var mapgen_demo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mapgen-demo */ \"../pkg/mapgen_demo.js\");\n\n\nconst x = mapgen_demo__WEBPACK_IMPORTED_MODULE_0__[\"add\"](1, 4);\nconsole.log(x);\n\n\n//# sourceURL=webpack:///./index.js?"); + +/***/ }), + +/***/ "./node_modules/webpack/buildin/global.js": +/*!***********************************!*\ + !*** (webpack)/buildin/global.js ***! + \***********************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n//# sourceURL=webpack:///(webpack)/buildin/global.js?"); + +/***/ }), + +/***/ "./node_modules/webpack/buildin/harmony-module.js": +/*!*******************************************!*\ + !*** (webpack)/buildin/harmony-module.js ***! + \*******************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +eval("module.exports = function(originalModule) {\n\tif (!originalModule.webpackPolyfill) {\n\t\tvar module = Object.create(originalModule);\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"exports\", {\n\t\t\tenumerable: true\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n\n\n//# sourceURL=webpack:///(webpack)/buildin/harmony-module.js?"); + +/***/ }) + +}]); \ No newline at end of file diff --git a/docs/bootstrap.js b/docs/bootstrap.js new file mode 100644 index 0000000..98abbdc --- /dev/null +++ b/docs/bootstrap.js @@ -0,0 +1,315 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // install a JSONP callback for chunk loading +/******/ function webpackJsonpCallback(data) { +/******/ var chunkIds = data[0]; +/******/ var moreModules = data[1]; +/******/ +/******/ +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) { +/******/ resolves.push(installedChunks[chunkId][0]); +/******/ } +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ for(moduleId in moreModules) { +/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { +/******/ modules[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(parentJsonpFunction) parentJsonpFunction(data); +/******/ +/******/ while(resolves.length) { +/******/ resolves.shift()(); +/******/ } +/******/ +/******/ }; +/******/ +/******/ +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // object to store loaded and loading chunks +/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched +/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ var installedChunks = { +/******/ "main": 0 +/******/ }; +/******/ +/******/ +/******/ +/******/ // script path function +/******/ function jsonpScriptSrc(chunkId) { +/******/ return __webpack_require__.p + "" + chunkId + ".bootstrap.js" +/******/ } +/******/ +/******/ // object to store loaded and loading wasm modules +/******/ var installedWasmModules = {}; +/******/ +/******/ function promiseResolve() { return Promise.resolve(); } +/******/ +/******/ var wasmImportObjects = { +/******/ "../pkg/mapgen_demo_bg.wasm": function() { +/******/ return { +/******/ "./mapgen_demo_bg.js": { +/******/ "__wbindgen_object_drop_ref": function(p0i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbindgen_object_drop_ref"](p0i32); +/******/ }, +/******/ "__wbg_instanceof_Window_adf3196bdc02b386": function(p0i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_instanceof_Window_adf3196bdc02b386"](p0i32); +/******/ }, +/******/ "__wbg_document_6cc8d0b87c0a99b9": function(p0i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_document_6cc8d0b87c0a99b9"](p0i32); +/******/ }, +/******/ "__wbg_body_8c888fe47d81765f": function(p0i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_body_8c888fe47d81765f"](p0i32); +/******/ }, +/******/ "__wbg_createElement_5bdf88a5af9f17c5": function(p0i32,p1i32,p2i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_createElement_5bdf88a5af9f17c5"](p0i32,p1i32,p2i32); +/******/ }, +/******/ "__wbg_setinnerHTML_4ff235db1a3cb4d8": function(p0i32,p1i32,p2i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_setinnerHTML_4ff235db1a3cb4d8"](p0i32,p1i32,p2i32); +/******/ }, +/******/ "__wbg_appendChild_77215fd672b162c5": function(p0i32,p1i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_appendChild_77215fd672b162c5"](p0i32,p1i32); +/******/ }, +/******/ "__wbg_call_8e95613cc6524977": function(p0i32,p1i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_call_8e95613cc6524977"](p0i32,p1i32); +/******/ }, +/******/ "__wbindgen_object_clone_ref": function(p0i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbindgen_object_clone_ref"](p0i32); +/******/ }, +/******/ "__wbg_newnoargs_f3b8a801d5d4b079": function(p0i32,p1i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_newnoargs_f3b8a801d5d4b079"](p0i32,p1i32); +/******/ }, +/******/ "__wbg_self_07b2f89e82ceb76d": function() { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_self_07b2f89e82ceb76d"](); +/******/ }, +/******/ "__wbg_window_ba85d88572adc0dc": function() { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_window_ba85d88572adc0dc"](); +/******/ }, +/******/ "__wbg_globalThis_b9277fc37e201fe5": function() { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_globalThis_b9277fc37e201fe5"](); +/******/ }, +/******/ "__wbg_global_e16303fe83e1d57f": function() { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbg_global_e16303fe83e1d57f"](); +/******/ }, +/******/ "__wbindgen_is_undefined": function(p0i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbindgen_is_undefined"](p0i32); +/******/ }, +/******/ "__wbindgen_throw": function(p0i32,p1i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbindgen_throw"](p0i32,p1i32); +/******/ }, +/******/ "__wbindgen_rethrow": function(p0i32) { +/******/ return installedModules["../pkg/mapgen_demo_bg.js"].exports["__wbindgen_rethrow"](p0i32); +/******/ } +/******/ } +/******/ }; +/******/ }, +/******/ }; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ // This file contains only the entry chunk. +/******/ // The chunk loading function for additional chunks +/******/ __webpack_require__.e = function requireEnsure(chunkId) { +/******/ var promises = []; +/******/ +/******/ +/******/ // JSONP chunk loading for javascript +/******/ +/******/ var installedChunkData = installedChunks[chunkId]; +/******/ if(installedChunkData !== 0) { // 0 means "already installed". +/******/ +/******/ // a Promise means "currently loading". +/******/ if(installedChunkData) { +/******/ promises.push(installedChunkData[2]); +/******/ } else { +/******/ // setup Promise in chunk cache +/******/ var promise = new Promise(function(resolve, reject) { +/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; +/******/ }); +/******/ promises.push(installedChunkData[2] = promise); +/******/ +/******/ // start chunk loading +/******/ var script = document.createElement('script'); +/******/ var onScriptComplete; +/******/ +/******/ script.charset = 'utf-8'; +/******/ script.timeout = 120; +/******/ if (__webpack_require__.nc) { +/******/ script.setAttribute("nonce", __webpack_require__.nc); +/******/ } +/******/ script.src = jsonpScriptSrc(chunkId); +/******/ +/******/ // create error before stack unwound to get useful stacktrace later +/******/ var error = new Error(); +/******/ onScriptComplete = function (event) { +/******/ // avoid mem leaks in IE. +/******/ script.onerror = script.onload = null; +/******/ clearTimeout(timeout); +/******/ var chunk = installedChunks[chunkId]; +/******/ if(chunk !== 0) { +/******/ if(chunk) { +/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type); +/******/ var realSrc = event && event.target && event.target.src; +/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')'; +/******/ error.name = 'ChunkLoadError'; +/******/ error.type = errorType; +/******/ error.request = realSrc; +/******/ chunk[1](error); +/******/ } +/******/ installedChunks[chunkId] = undefined; +/******/ } +/******/ }; +/******/ var timeout = setTimeout(function(){ +/******/ onScriptComplete({ type: 'timeout', target: script }); +/******/ }, 120000); +/******/ script.onerror = script.onload = onScriptComplete; +/******/ document.head.appendChild(script); +/******/ } +/******/ } +/******/ +/******/ // Fetch + compile chunk loading for webassembly +/******/ +/******/ var wasmModules = {"0":["../pkg/mapgen_demo_bg.wasm"]}[chunkId] || []; +/******/ +/******/ wasmModules.forEach(function(wasmModuleId) { +/******/ var installedWasmModuleData = installedWasmModules[wasmModuleId]; +/******/ +/******/ // a Promise means "currently loading" or "already loaded". +/******/ if(installedWasmModuleData) +/******/ promises.push(installedWasmModuleData); +/******/ else { +/******/ var importObject = wasmImportObjects[wasmModuleId](); +/******/ var req = fetch(__webpack_require__.p + "" + {"../pkg/mapgen_demo_bg.wasm":"f138b06b088ae74c6a29"}[wasmModuleId] + ".module.wasm"); +/******/ var promise; +/******/ if(importObject instanceof Promise && typeof WebAssembly.compileStreaming === 'function') { +/******/ promise = Promise.all([WebAssembly.compileStreaming(req), importObject]).then(function(items) { +/******/ return WebAssembly.instantiate(items[0], items[1]); +/******/ }); +/******/ } else if(typeof WebAssembly.instantiateStreaming === 'function') { +/******/ promise = WebAssembly.instantiateStreaming(req, importObject); +/******/ } else { +/******/ var bytesPromise = req.then(function(x) { return x.arrayBuffer(); }); +/******/ promise = bytesPromise.then(function(bytes) { +/******/ return WebAssembly.instantiate(bytes, importObject); +/******/ }); +/******/ } +/******/ promises.push(installedWasmModules[wasmModuleId] = promise.then(function(res) { +/******/ return __webpack_require__.w[wasmModuleId] = (res.instance || res).exports; +/******/ })); +/******/ } +/******/ }); +/******/ return Promise.all(promises); +/******/ }; +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // on error function for async loading +/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; +/******/ +/******/ // object with all WebAssembly.instance exports +/******/ __webpack_require__.w = {}; +/******/ +/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; +/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); +/******/ jsonpArray.push = webpackJsonpCallback; +/******/ jsonpArray = jsonpArray.slice(); +/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); +/******/ var parentJsonpFunction = oldJsonpFunction; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./bootstrap.js"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./bootstrap.js": +/*!**********************!*\ + !*** ./bootstrap.js ***! + \**********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +eval("// A dependency graph that contains any wasm must all be imported\n// asynchronously. This `bootstrap.js` file does the single async import, so\n// that no one else needs to worry about it again.\n__webpack_require__.e(/*! import() */ 0).then(__webpack_require__.bind(null, /*! ./index.js */ \"./index.js\"))\n .catch(e => console.error(\"Error importing `index.js`:\", e));\n\n\n//# sourceURL=webpack:///./bootstrap.js?"); + +/***/ }) + +/******/ }); \ No newline at end of file diff --git a/docs/f138b06b088ae74c6a29.module.wasm b/docs/f138b06b088ae74c6a29.module.wasm new file mode 100644 index 0000000000000000000000000000000000000000..df8bd3e92f6b98d43e7d62481625f9d7192f9bfe GIT binary patch literal 17489 zcmb`PZ)_ZAe&3&&*^}3%^Y8cn-^|j@ZQc%?bHSUzXK#i(JHgJ)XvZ2l z?q5bWOx1T-^qqwRa@AxZehoI*)&##ula4m z|6MxunM;>%&)vDzS({z#++LrZzjdj*d3JX8-u&{~qVBHGcRLGPvx~j;JF~scl8cU7 zFs22!W|!ACx8~LsI_pcb|D5IP_h#o7mnO%joAZkc^@;h(cGH!PT7KRyUtC|fd%Lr? zHQQWRXfM|1+pUHA-1PMP^wFzE{i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B%rm6EpU55OUS%&D_f1;CT(8&1 z>l5|KdZRv7Z`ND&c71xhK0ZD^F+Mro7@rz%j|$ymM7;15tNbtV%C pQ@>bmUz}(>Rl0{@-rX$KFO9b^)rar#*F!F5f1rSS6PKFp{|kDx3C92c literal 0 HcmV?d00001 diff --git a/docs/index.html b/docs/index.html index 4d44e59..ca5615c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,30 +2,10 @@ - Mapgen demo - + Hello wasm-pack! -

Map generator demo

- -
- - + + diff --git a/docs/index.js b/docs/index.js deleted file mode 100644 index fb41e3f..0000000 --- a/docs/index.js +++ /dev/null @@ -1,199 +0,0 @@ -import { Universe, Cell } from "wasm-game-of-life"; -import { memory } from "wasm-game-of-life/wasm_game_of_life_bg"; - -const CELL_SIZE = 8; // px -const GRID_COLOR = "#CCCCCC"; -const DEAD_COLOR = "#FFFFFF"; -const ALIVE_COLOR = "#000000"; - -// Construct the universe, and get its width and height. -// const universe = Universe.new_spaceship(); -const universe = Universe.new(); -const width = universe.width(); -const height = universe.height(); - -// Give the canvas room for all of our cells and a 1px border -// around each of them. -const canvas = document.getElementById("game-of-life-canvas"); -canvas.height = (CELL_SIZE + 1) * height + 1; -canvas.width = (CELL_SIZE + 1) * width + 1; - -const ctx = canvas.getContext('2d'); - -let animationId = null; - -const renderLoop = () => { - fps.render(); - for (let i = 0; i < 9; i++) { - universe.tick(); - } - - drawGrid(); - drawCells(); - - animationId = requestAnimationFrame(renderLoop); -}; - -const drawGrid = () => { - ctx.beginPath(); - ctx.strokeStyle = GRID_COLOR; - - // Vertical lines. - for (let i = 0; i <= width; i++) { - ctx.moveTo(i * (CELL_SIZE + 1) + 1, 0); - ctx.lineTo(i * (CELL_SIZE + 1) + 1, (CELL_SIZE + 1) * height + 1); - } - - // Horizontal lines. - for (let j = 0; j <= height; j++) { - ctx.moveTo(0, j * (CELL_SIZE + 1) + 1); - ctx.lineTo((CELL_SIZE + 1) * width + 1, j * (CELL_SIZE + 1) + 1); - } - - ctx.stroke(); -}; - -const getIndex = (row, column) => { - return row * width + column; -}; - -const drawCells = () => { - const cellsPtr = universe.cells(); - - // This is updated! - const cells = new Uint8Array(memory.buffer, cellsPtr, width * height / 8); - - ctx.beginPath(); - - // Alive cells. - ctx.fillStyle = ALIVE_COLOR; - for (let row = 0; row < height; row++) { - for (let col = 0; col < width; col++) { - const idx = getIndex(row, col); - if (!bitIsSet(idx, cells)) { - continue; - } - - ctx.fillRect( - col * (CELL_SIZE + 1) + 1, - row * (CELL_SIZE + 1) + 1, - CELL_SIZE, - CELL_SIZE - ); - } - } - - // Dead cells. - ctx.fillStyle = DEAD_COLOR; - for (let row = 0; row < height; row++) { - for (let col = 0; col < width; col++) { - const idx = getIndex(row, col); - if (bitIsSet(idx, cells)) { - continue; - } - - ctx.fillRect( - col * (CELL_SIZE + 1) + 1, - row * (CELL_SIZE + 1) + 1, - CELL_SIZE, - CELL_SIZE - ); - } - } - - ctx.stroke(); -}; - -const bitIsSet = (n, arr) => { - const byte = Math.floor(n / 8); - const mask = 1 << (n % 8); - return (arr[byte] & mask) === mask; -}; - -const isPaused = () => { - return animationId === null; -}; - -const playPauseButton = document.getElementById("play-pause"); - -const play = () => { - playPauseButton.textContent = "⏸"; - renderLoop(); -}; - -const pause = () => { - playPauseButton.textContent = "▶"; - cancelAnimationFrame(animationId); - animationId = null; -}; - -playPauseButton.addEventListener("click", event => { - if (isPaused()) { - play(); - } else { - pause(); - } -}); - -canvas.addEventListener("click", event => { - const boundingRect = canvas.getBoundingClientRect(); - - const scaleX = canvas.width / boundingRect.width; - const scaleY = canvas.height / boundingRect.height; - - const canvasLeft = (event.clientX - boundingRect.left) * scaleX; - const canvasTop = (event.clientY - boundingRect.top) * scaleY; - - const row = Math.min(Math.floor(canvasTop / (CELL_SIZE + 1)), height - 1); - const col = Math.min(Math.floor(canvasLeft / (CELL_SIZE + 1)), width - 1); - - universe.toggle_cell(row, col); - - drawGrid(); - drawCells(); -}); - -const fps = new class { - constructor() { - this.fps = document.getElementById("fps"); - this.frames = []; - this.lastFrameTimeStamp = performance.now(); - } - - render() { - // Convert the delta time since the last frame render into a measure - // of frames per second. - const now = performance.now(); - const delta = now - this.lastFrameTimeStamp; - this.lastFrameTimeStamp = now; - const fps = 1 / delta * 1000; - - // Save only the latest 100 timings. - this.frames.push(fps); - if (this.frames.length > 100) { - this.frames.shift(); - } - - // Find the max, min, and mean of our 100 latest timings. - let min = Infinity; - let max = -Infinity; - let sum = 0; - for (let i = 0; i < this.frames.length; i++) { - sum += this.frames[i]; - min = Math.min(this.frames[i], min); - max = Math.max(this.frames[i], max); - } - let mean = sum / this.frames.length; - - // Render the statistics. - this.fps.textContent = ` -Frames per Second: - latest = ${Math.round(fps)} -avg of last 100 = ${Math.round(mean)} -min of last 100 = ${Math.round(min)} -max of last 100 = ${Math.round(max)} -`.trim(); - } -}; - -play(); \ No newline at end of file