Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make singleton mode actually a singleton! #18

Merged
merged 2 commits into from
Jan 14, 2020
Merged

Conversation

developit
Copy link
Collaborator

This should fix #1, since TypeScript can now be used like so:

// webpack.config.js
module.exports = {
  module: {
    rules: [
      {
        test: /\.worker\.(js|ts)x?$/i,
        use: [{
          loader: 'comlink-loader',
          options: {
            singleton: true
          }
        }]
      }
    ]
  }
}
// index.ts
import { greet } from './hello.worker.ts';

(async () => {
  console.log( await greet('dog') );
})();
// hello.worker.ts

export function greet(subject: string): string {
  return `Hello, ${subject}!`;
}
@developit developit merged commit 7cc2dee into master Jan 14, 2020
@developit developit deleted the new-singleton-mode branch January 14, 2020 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant