mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-09-28 06:55:25 +00:00
larry babby and threejs for glsl
This commit is contained in:
49
webGl/my-threejs-test/node_modules/@parcel/workers/lib/threads/ThreadsChild.js
generated
vendored
Normal file
49
webGl/my-threejs-test/node_modules/@parcel/workers/lib/threads/ThreadsChild.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _worker_threads() {
|
||||
const data = require("worker_threads");
|
||||
_worker_threads = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _nullthrows() {
|
||||
const data = _interopRequireDefault(require("nullthrows"));
|
||||
_nullthrows = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _childState = require("../childState");
|
||||
var _child = require("../child");
|
||||
function _core() {
|
||||
const data = require("@parcel/core");
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
class ThreadsChild {
|
||||
constructor(onMessage, onExit) {
|
||||
if (_worker_threads().isMainThread || !_worker_threads().parentPort) {
|
||||
throw new Error('Only create ThreadsChild instances in a worker!');
|
||||
}
|
||||
this.onMessage = onMessage;
|
||||
this.onExit = onExit;
|
||||
_worker_threads().parentPort.on('message', data => this.handleMessage(data));
|
||||
_worker_threads().parentPort.on('close', this.onExit);
|
||||
}
|
||||
handleMessage(data) {
|
||||
this.onMessage((0, _core().restoreDeserializedObject)(data));
|
||||
}
|
||||
send(data) {
|
||||
(0, _nullthrows().default)(_worker_threads().parentPort).postMessage((0, _core().prepareForSerialization)(data));
|
||||
}
|
||||
}
|
||||
exports.default = ThreadsChild;
|
||||
(0, _childState.setChild)(new _child.Child(ThreadsChild));
|
61
webGl/my-threejs-test/node_modules/@parcel/workers/lib/threads/ThreadsWorker.js
generated
vendored
Normal file
61
webGl/my-threejs-test/node_modules/@parcel/workers/lib/threads/ThreadsWorker.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _worker_threads() {
|
||||
const data = require("worker_threads");
|
||||
_worker_threads = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _core() {
|
||||
const data = require("@parcel/core");
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
const WORKER_PATH = _path().default.join(__dirname, 'ThreadsChild.js');
|
||||
class ThreadsWorker {
|
||||
constructor(execArgv, onMessage, onError, onExit) {
|
||||
this.execArgv = execArgv;
|
||||
this.onMessage = onMessage;
|
||||
this.onError = onError;
|
||||
this.onExit = onExit;
|
||||
}
|
||||
start() {
|
||||
this.worker = new (_worker_threads().Worker)(WORKER_PATH, {
|
||||
execArgv: this.execArgv,
|
||||
env: process.env
|
||||
});
|
||||
this.worker.on('message', data => this.handleMessage(data));
|
||||
this.worker.on('error', this.onError);
|
||||
this.worker.on('exit', this.onExit);
|
||||
return new Promise(resolve => {
|
||||
this.worker.on('online', resolve);
|
||||
});
|
||||
}
|
||||
stop() {
|
||||
// In node 12, this returns a promise, but previously it accepted a callback
|
||||
// TODO: Pass a callback in earlier versions of Node
|
||||
return Promise.resolve(this.worker.terminate());
|
||||
}
|
||||
handleMessage(data) {
|
||||
this.onMessage((0, _core().restoreDeserializedObject)(data));
|
||||
}
|
||||
send(data) {
|
||||
this.worker.postMessage((0, _core().prepareForSerialization)(data));
|
||||
}
|
||||
}
|
||||
exports.default = ThreadsWorker;
|
Reference in New Issue
Block a user