Skip to content

Commit

Permalink
Merge pull request #522 from pusher/add-worker-entrypoint
Browse files Browse the repository at this point in the history
Add worker entrypoints
  • Loading branch information
James Lees authored Jan 25, 2021
2 parents 9caf745 + f2caece commit b18f843
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,18 @@ If you'd like to use encrypted channels:
importScripts('https://js.pusher.com/7.0/pusher-with-encryption.worker.min.js');
```

If you're building your worker with a bundler, you can import the worker entrypoint

```
import Pusher from 'pusher-js/worker'
```

If you'd like to use encrypted channels:

```
import Pusher from 'pusher-js/worker/with-encryption'
```

### Node.js

Having installed `pusher-js` via an NPM-compatible package manager, run:
Expand Down
15 changes: 15 additions & 0 deletions worker/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export {
Authorizer,
AuthOptions,
AuthorizerGenerator,
AuthorizerCallback,
} from '../types/src/core/auth/options';
export { Options } from '../types/src/core/options';

export { default as Channel } from '../types/src/core/channels/channel';
export { default as PresenceChannel } from '../types/src/core/channels/presence_channel';
export { default as Members } from '../types/src/core/channels/members';
export { default as Runtime } from '../types/src/runtimes/interface';
export { default as ConnectionManager } from '../types/src/core/connection/connection_manager';

export { default } from '../types/src/core/pusher';
1 change: 1 addition & 0 deletions worker/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../dist/worker/pusher.worker.js');
15 changes: 15 additions & 0 deletions worker/with-encryption/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export {
Authorizer,
AuthOptions,
AuthorizerGenerator,
AuthorizerCallback,
} from '../../types/src/core/auth/options';
export { Options } from '../../types/src/core/options';

export { default as Channel } from '../../types/src/core/channels/channel';
export { default as PresenceChannel } from '../../types/src/core/channels/presence_channel';
export { default as Members } from '../../types/src/core/channels/members';
export { default as Runtime } from '../../types/src/runtimes/interface';
export { default as ConnectionManager } from '../../types/src/core/connection/connection_manager';

export { default } from '../../types/src/core/pusher';
1 change: 1 addition & 0 deletions worker/with-encryption/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../dist/worker/pusher-with-encryption.worker.js');

0 comments on commit b18f843

Please sign in to comment.