tranel
v0.3.0
Published
Access cross-process API elegant and natural
Downloads
3
Readme
Tranel
Worker First DOM Manipulate Library
Characteristics
- Use DOM API like main thread in dom
Note: you should clean ref in worker
Compatibility
Unit tests guarantee support on the following environment:
| IE | CH | SF | IOS | Android | | ---- | ---- | ---- | ---- | ---- | | 10+ | ALL | 9+ | 9+ | 5+ |
Note: code depend on Proxy API, so you need import Polyfill to compatible with old version.
Directory
├── demo - Using demo
├── dist - Compiler output code
├── docs - Project documents
├── src - Source code directory
├── test - Unit tests
├── CHANGELOG.md - Change log
Usage Instructions
Using npm, download and install the code.
$ npm install --save tranel
For Render Thread:
<script src="../../lib/tranel.js"></script>
<script>
new Tranel().listen("./worker.js").registerGlobal()
</script>
For Worker Thread:
importScripts("../../lib/tranel.js");
new Tranel().listen().registerGlobal()
Then you can use DOM API in worker:
let $wcomputeButton = document.getElementById('wcompute');
let $wresult = document.getElementById('wresult');
let $input = document.getElementById('input')
$wcomputeButton.addEventListener('click', () => {
$wresult.innerText = $input.value
})
Open demo get more example.
Documents
Contribution Guide
How to switch JS
and TS
srctype
andscripts
inpackage.json
require
file oftest/test.js
require
file oftest/browser/index.html
For the first time to run, you need to install dependencies firstly.
$ npm install
To dev & serve demo
$ npm run dev
To build the project:
$ npm run build
To run unit tests:
$ npm t
Note: The browser environment needs to be tested manually under
test/browser
Modify the version number in package.json, modify the version number in README.md, modify the CHANGELOG.md, and then release the new version.
$ npm run release
Publish the new version to NPM.
$ npm publish