Skip to content

Commit

Permalink
chore: choose a different name due to package naming conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
olehpratsko committed Jun 12, 2023
1 parent 3a4b2d9 commit 98a2650
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# Web Boss
# Web Worker Boss

Web Boss is a lightweight library that provides a simple and intuitive socket-like API for sending and receiving messages between the main thread and the worker.
Web Worker Boss is a lightweight library that provides a simple and intuitive socket-like API for sending and receiving messages between the main thread and the worker.

## Installation

You can install Web Boss using npm or yarn:
You can install Web Worker Boss using npm or yarn:

```bash
npm install web-boss
npm install web-worker-boss
```

or

```bash
yarn add web-boss
yarn add web-worker-boss
```

## Usage

To use Web Boss for bi-directional communication, follow these steps:
To use Web Worker Boss for bi-directional communication, follow these steps:

1. Import the Boss class from the web-boss package:
1. Import the Boss class from the web-worker-boss package:

```javascript
import Boss from 'web-boss';
import Boss from 'web-worker-boss';
```

2. In the main thread, create an instance of Boss, passing in the web worker object as a parameter:
Expand All @@ -46,10 +46,10 @@ boss.on('eventName', (payload) => {
boss.emit('eventName', payload);
```

5. In the web worker script, import the Boss class from the web-boss package. Make sure you are using webpack or Rollup to bundle the web worker script.
5. In the web worker script, import the Boss class from the web-worker-boss package. Make sure you are using webpack or Rollup to bundle the web worker script.

```javascript
import Boss from 'web-boss';
import Boss from 'web-worker-boss';
```

6. Create an instance of Boss in the web worker, passing in the self object as a parameter:
Expand All @@ -74,12 +74,12 @@ boss.emit('eventName', payload);

## Example

Here's an example demonstrating the usage of Web Boss for bi-directional communication:
Here's an example demonstrating the usage of Web Worker Boss for bi-directional communication:

### Main script:

```javascript
import Boss from 'web-boss';
import Boss from 'web-worker-boss';

const worker = new Worker('worker.js');
const boss = new Boss(worker);
Expand All @@ -94,7 +94,7 @@ boss.emit('ask', { question: 'How are you?' });
### Web worker script (worker.js):

```javascript
import Boss from 'web-boss';
import Boss from 'web-worker-boss';

const boss = new Boss(self);

Expand All @@ -115,7 +115,7 @@ The web worker script creates an instance of Boss with self, which represents th

Both the main script and the web worker script can communicate with each other using the emit and on methods of the Boss instance.

## API
## Web Worker Boss API

### `new Boss(worker: Worker)`

Expand All @@ -139,6 +139,6 @@ Emits an event to the web worker.

---

That's it! You now have a better understanding of how to use the Web Boss library for bi-directional communication between the main thread and a web worker in your web applications. Feel free to explore more features and advanced usage in the library's documentation or by examining the source code.
That's it! You now have a better understanding of how to use the Web Worker Boss library for bi-directional communication between the main thread and a web worker in your web applications. Feel free to explore more features and advanced usage in the library's documentation or by examining the source code.

If you encounter any issues or have further questions, please don't hesitate to ask.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "web-boss",
"name": "web-worker-boss",
"version": "1.0.0",
"description": "Communicate with your Web Workers like a boss.",
"description": "Communicate with your workers like a boss.",
"main": "lib/boss.js",
"scripts": {
"server": "node server.js"
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
</head>
<body>
<h1>Web Boss</h1>
<h1>Web Worker Boss</h1>
<p>Check your browser console</p>
</body>
</html>

0 comments on commit 98a2650

Please sign in to comment.