mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-28 13:13:37 +08:00
Breaking changes here https://github.com/mochajs/mocha/releases/tag/v8.0.0 seem fine. DISABLE_THIRD_PARTY_CHECK=Update Mocha Bug: chromium:1101784 Change-Id: Idc75c94f9a923e2b0ca13d1d1331540cb1c5d3a3 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2279830 Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Peter Marshall <petermarshall@chromium.org>
30 lines
762 B
JavaScript
30 lines
762 B
JavaScript
// This example worker runs asynchronous tasks. In practice, this could be
|
|
// interacting with a database or a web service. The asynchronous function
|
|
// returns a promise which resolves with the task's result.
|
|
|
|
var workerpool = require('../..');
|
|
|
|
// an async function returning a promise
|
|
function asyncAdd (a, b) {
|
|
return new Promise(function (resolve, reject) {
|
|
setTimeout(function () {
|
|
resolve(a + b);
|
|
}, 1000);
|
|
});
|
|
}
|
|
|
|
// an async function returning a promise
|
|
function asyncMultiply (a, b) {
|
|
return new Promise(function (resolve, reject) {
|
|
setTimeout(function () {
|
|
resolve(a * b);
|
|
}, 1000);
|
|
});
|
|
}
|
|
|
|
// create a worker and register public functions
|
|
workerpool.worker({
|
|
asyncAdd: asyncAdd,
|
|
asyncMultiply: asyncMultiply
|
|
});
|