Skip to content

Commit

Permalink
Added api map
Browse files Browse the repository at this point in the history
  • Loading branch information
duart38 committed Aug 27, 2020
1 parent 6016961 commit c2f2ffc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,22 @@ new Thread((e: MessageEvent)=>{return 0}); // inline Thread with return type of
new Thread(someFunction); // thread an already existing function
new Thread(someFunction, ['import Something from "../some.bundle.js";']); // thread with custom importing
```

## API

### Standard API
| Method / variable | Description |
|------------------------------------ |---------------------------------------------------------------------------------------------------------------------------- |
| filePath | The full path to the worker file (in temp dir) |
| worker | The Worker. |
| stopped | Tells if the worker has been stopped |
| postMessage(msg) | Sends data to the Thread |
| stop() | calls terminate on the worker. |
| remove() | Removes the current worker file from the temporary folder. NOTE: Can be used while the program is running (calls stop()..) |
| onMessage(callback: (e: T) =>void) | Bind to the worker to receive messages |

### Utilities

| Method / variable | Description |
|---------------------- |--------------------------------------------------------------------------------------------------------------------- |
| cleanWorkerImports() | Removes all worker related imports from the temp folder.<br>WARNING: Do not run this while your program is running. |

0 comments on commit c2f2ffc

Please sign in to comment.