Last active
August 12, 2019 04:02
-
-
Save o-mega/b7a1c238c8146709a328528e6527e011 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import * as serviceWorker from './serviceWorker'; | |
import createWorker from 'offscreen-canvas/create-worker'; | |
import App from './App'; | |
import { Store } from './Store'; | |
ReactDOM.render( | |
<Store.Provider> | |
<App /> | |
</Store.Provider>, | |
document.getElementById('root')); | |
const workerUrl = document.querySelector('[rel=preload][as=script]').href; | |
const canvas = document.querySelector('canvas'); | |
export const worker = createWorker(canvas, workerUrl, e => { | |
console.log(e); | |
}); | |
serviceWorker.unregister(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["webgl"],{ | |
/***/ "./node_modules/offscreen-canvas/inside-worker.js": | |
/*!********************************************************!*\ | |
!*** ./node_modules/offscreen-canvas/inside-worker.js ***! | |
\********************************************************/ | |
/*! no static exports found */ | |
/***/ (function(module, exports) { | |
module.exports = function (listener) { | |
if (typeof window !== 'object') { | |
onmessage = listener; | |
return { | |
post: function (a, b) { | |
postMessage(a, b); | |
}, | |
isWorker: true | |
}; | |
} else { | |
var randomId = document.currentScript.dataset.id; | |
var connection = window[randomId]; | |
delete window[randomId]; | |
connection.worker = listener; | |
setTimeout(function () { | |
connection.msgs.forEach(function (data) { | |
connection.worker({ | |
data: data | |
}); | |
}); | |
}, 1); | |
return { | |
post: function (data) { | |
connection.host({ | |
data: data | |
}); | |
}, | |
isWorker: false | |
}; | |
} | |
}; | |
/***/ }), | |
/***/ "./src/webgl.worker.js": | |
/*!*****************************!*\ | |
!*** ./src/webgl.worker.js ***! | |
\*****************************/ | |
/*! no exports provided */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony import */ var offscreen_canvas_inside_worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! offscreen-canvas/inside-worker */ "./node_modules/offscreen-canvas/inside-worker.js"); | |
/* harmony import */ var offscreen_canvas_inside_worker__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(offscreen_canvas_inside_worker__WEBPACK_IMPORTED_MODULE_0__); | |
offscreen_canvas_inside_worker__WEBPACK_IMPORTED_MODULE_0___default()(e => { | |
console.log(e); | |
if (e.data.canvas) { | |
alert('loaded'); | |
} | |
}); | |
/***/ }) | |
},[["./src/webgl.worker.js","runtime~webgl"]]]); | |
//# sourceMappingURL=webgl.chunk.js.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import insideWorker from 'offscreen-canvas/inside-worker'; | |
insideWorker(e => { | |
console.log(e); | |
if (e.data.canvas) { | |
alert('loaded'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment