tranel v0.3.0
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 logUsage Instructions
Using npm, download and install the code.
$ npm install --save tranelFor 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
srctypeandscriptsinpackage.jsonrequirefile oftest/test.jsrequirefile oftest/browser/index.html
For the first time to run, you need to install dependencies firstly.
$ npm installTo dev & serve demo
$ npm run devTo build the project:
$ npm run buildTo run unit tests:
$ npm tNote: 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 releasePublish the new version to NPM.
$ npm publish