webworker.jsx
Synopsis
WebWorker API wrapper for JSX
Code Example
WebWorker Code Sample
;; static var counter = 0; static : void { // called when loading. } static : void { }
Client Code Sample
;;; static : void { var worker = 'src/sample.js'; workeronmessage = event-> domdocument; ; worker; Timer; }
Installation
You need jsx-linker
to create runnable code:
$ npm install webworker.jsx$ npm install jsx-linker
To compile source code, use jsx-linker like this:
$ jsx src.jsx | jsx-linker -s -t webworker > worker.js
The simplest way to create WebWorker, use jsx-init 0.3.0 or later.
API Reference
function postMessage(message : variant/any/) : void;
function postMessage(message : variant/any/, transfer : Transferable[]) : void;
function close() : void;
function btoa(btoa : string/DOMString/) : string/DOMString/;
function atob(atob : string/DOMString/) : string/DOMString/;
function setTimeout(callback : function():void, intervalMS : number) : TimerHandle
function clearTimeout(timer : TimerHandle) : void;
function setInterval(callback : function():void, intervalMS : number) : TimerHandle;
function clearInterval(timer : TimerHandle) : void;
Development
Repository
- Repository: git:/github.com/shibukawa/webworker.jsx.git
- Issues: https://github.com/shibukawa/webworker.jsx/issues
Run Test
$ grunt test
Run Sample
# Generate API reference $ grunt doc # Build web worker sample $ grunt jsx:build # Build client sample $ grunt jsx:build # Launch webserver $ grunt connect
Author
- shibukawa / yoshiki@shibu.jp
License
MIT
Complete license is written in LICENSE.md
.