We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unable to gets this example running any help would be appreciated. Thank you.
`
<br /> <button id="get-free">Get next task</button> <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/softvar/super-workers@master/dist/super-workers.min.js"></script> <script type="text/javascript"> document.addEventListener('DOMContentLoaded', function(event) { var blob = new Blob([document.querySelector('#worker').textContent]); blobURL = window.URL.createObjectURL(blob); var main = window.main = new SuperWorkers.MainThread({ url: blobURL, maxWorkers: 3, // hardwareConcurrency minWorkers: 1, killWorkersAfterJob: true }); var prom; function add(a, b) { var p = SuperWorkers.Promise.defer(); // p.promise.timeout(1000) setTimeout(function () { return p.resolve(a + b); }, 2000); // p.promise.cancel(); return p.promise; } document.getElementById('open-low').addEventListener('click', function () { prom = window.main.exec('add', [1,2], { priority: 'low', name: 'add-low' }).then(function (val) { console.log(val); }).catch(function (err) { console.log(err) }); /*window.main.workers[0].worker.postMessage({ id: window.main.workers[0].id, action: 'handshake', message: 'Hello' });*/ }, false); document.getElementById('open-medium').addEventListener('click', function () { prom = window.main.exec(add, [2, 3], { priority: 'medium', name: 'add-medium' }).then(function (val) { console.log(val); }).catch(function (err) { console.log(err) }); }, false); document.getElementById('open-high').addEventListener('click', function () { prom = window.main.exec(add, [4, 5], { priority: 'high', name: 'add-high' }).then(function (val) { console.log(val); }).catch(function (err) { console.log(err) }); }, false); document.getElementById('get-free').addEventListener('click', function () { console.log(window.main.taskQueue.getNextTask()); }, false); }); </script> <script id="worker" type="javascript/worker"> importScripts('https://cdn.jsdelivr.net/gh/softvar/super-workers@master/dist/super-workers.min.js'); var child = new SuperWorkers.WorkerThread(); child.exposeMethods({ add: function (a, b) { return a + b; } }); </script>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
unable to gets this example running any help would be appreciated. Thank you.
`
<title>Super Workers | Home</title> Start a new low-priority task Start a new mediun-priority task Start a new high-priority taskThe text was updated successfully, but these errors were encountered: