mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-27 18:17:40 +00:00
Node + browser-friendly index.ts.
This commit is contained in:
parent
f87bbb4b07
commit
e1e22e7bcf
1 changed files with 12 additions and 2 deletions
|
|
@ -1,4 +1,14 @@
|
|||
// Dummy module for getting environment setup.
|
||||
module.exports ={
|
||||
hello: () => 'hello'
|
||||
class MyWorker {
|
||||
public hello() {
|
||||
return 'hello';
|
||||
}
|
||||
}
|
||||
|
||||
// The technique below allows code to work both in-browser and in Node.
|
||||
if(typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = new MyWorker();
|
||||
} else {
|
||||
//@ts-ignore
|
||||
window.worker = new MyWorker();
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue