- Notifications
You must be signed in to change notification settings - Fork0
Thread and ThreadPool functions.
License
NotificationsYou must be signed in to change notification settings
uupaa/Thread.js
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Thread and ThreadPool functions.
This module made ofWebModule.
// main.html<scriptsrc="<module-dir>/lib/WebModule.js"></script><scriptsrc="<module-dir>/lib/Thread.js"></script><script>var thread = new WebModule.Thread("worker.js", function postMessageHandler(args){;}, function(exitCode){switch(exitCode){caseThread.EXIT_OK:console.log("Closed.");break;caseThread.EXIT_ERROR:console.log("Terminates with an error from WorkerThread. "+errorMessage);break;caseThread.EXIT_FORCE:console.log("Forced termination by user.");break;caseThread.EXIT_TIMEOUT:console.log("Watchdog barked.");}});thread.post(["HELLO",123],null,functionpostbackMessageHandler(args){console.log(args[0]);// "HELLO WORLD"thread.close();});</script>
// worker.jsimportScripts("<module-dir>/lib/WebModule.js");importScripts("<module-dir>/lib/ThreadProxy.js");varthread=newWebModule.ThreadProxy(functionpostMessageHandler(args,event){console.log(args[0]);// "HELLO"console.log(args[1]);// 123event.postback(args[0]+" WORLD");// call to postbackMessageHandler},functioncloseRequestHandler(yes,ng){// .... destruction process...yes();// -> closed as usual.});
About
Thread and ThreadPool functions.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.