# coterminous-js-messageport

> A transport for use with Message Ports such as WebWorkers

Latest version **0.2.0** (published 2016-08-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install coterminous-js-messageport
pnpm add coterminous-js-messageport
yarn add coterminous-js-messageport
bun add coterminous-js-messageport
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2016-08-02 |
| First published | 2016-08-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jake Tober |
| Maintainers | tobes31415 |
| Keywords | webpack, es6, rpc |

## Links

- npm: https://www.npmjs.com/package/coterminous-js-messageport
- Repository: https://github.com/tobes31415/coterminous-js-messageport
- Homepage: https://github.com/tobes31415/coterminous-js-messageport#readme
- Issues: https://github.com/tobes31415/coterminous-js-messageport/issues
- npm.io page: https://npm.io/package/coterminous-js-messageport

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2016-08-02
- 0.1.7 — 2016-08-02

## README

# coterminous-js-messageport
A transport for use with Message Ports such as WebWorkers

### Useage in the Worker
```
Coterminous.root({
    //... your exposed api functions here
    hello : function(){return "world";}
});

onconnect = function(e) {
  Coterminous.connectTransport(new MessagePortTransport(e.ports[0]));
}
```

### Useage in the Browser
```
var worker = new SharedWorker('worker.js');
Coterminous.connect(new MessagePortTransport(worker.port)).then(function(remoteInterface)
{
    //do stuff
    remoteInterface.hello().then(function(response)
    {
        console.log(response);
    });
});
```
  
### Changing Direction
Connect - connects and gets the root object

ConnectTransport - just connects

You can swap these around to suit your needs, worker going to call the webpage?  use connect.  api calls in both directions?  sure! Use connect in both places.

---
_Source: https://npm.io/package/coterminous-js-messageport · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
