Skip to content

Commit 2b51673

Browse files
committedJan 14, 2025
Merge branch 'binary'
2 parents 6fcfc12 + 94a6830 commit 2b51673

File tree

3 files changed

+2
-90
lines changed

3 files changed

+2
-90
lines changed
 

‎README.md

+1-71
Original file line numberDiff line numberDiff line change
@@ -17,74 +17,4 @@ An IPC[^1] system for MCBE Script API projects
1717

1818
**TypeScript**
1919
1. Download `ipc.ts` from the latest [release](https://github.com/OmniacDev/MCBE-IPC/releases/latest)
20-
2. Copy file into your project
21-
22-
## Usage
23-
24-
### Sending & Receiving
25-
26-
`IPC.send()` and `IPC.on()` can be used to send messages or data between packs.
27-
28-
_Pack 1_
29-
```js
30-
import IPC from 'ipc.js'
31-
32-
IPC.on('message_channel', (args) => {
33-
console.log(`Message: ${args}`)
34-
})
35-
36-
IPC.on('data_channel', (args) => {
37-
console.log(`Data: ${args.example_bool}, ${args.example_number}`)
38-
})
39-
```
40-
_Pack 2_
41-
```js
42-
import IPC from 'ipc.js'
43-
44-
IPC.send('message_channel', 'Example Message')
45-
46-
IPC.send('data_channel', { example_number: 100, example_bool: true })
47-
```
48-
_Console Output_
49-
```
50-
Message: Example Message
51-
Data: true, 100
52-
```
53-
54-
### Requesting & Serving
55-
56-
`IPC.invoke()` and `IPC.handle()` can be used to request and serve data between packs.
57-
58-
_Pack 1_
59-
```js
60-
import IPC from 'ipc.js'
61-
62-
IPC.handle('request_channel', (args) => {
63-
switch (args) {
64-
case 'status':
65-
return 'inactive'
66-
case 'size':
67-
return 100
68-
}
69-
})
70-
```
71-
_Pack 2_
72-
```js
73-
import IPC from 'ipc.js'
74-
75-
IPC.invoke('request_channel', 'status').then(result => {
76-
console.log(`Status: ${result}`)
77-
})
78-
79-
IPC.invoke('request_channel', 'size').then(result => {
80-
console.log(`Size: ${result}`)
81-
})
82-
```
83-
_Console Output_
84-
```
85-
Status: inactive
86-
Size: 100
87-
```
88-
89-
90-
20+
2. Copy file into your project

‎TYPES.md

-18
This file was deleted.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"author": "OmniacDev",
44
"description": "IPC system for MCBE Script API projects",
55
"license": "MIT",
6-
"version": "2.0.1",
6+
"version": "3.0.0",
77
"repository": {
88
"type": "git",
99
"url": "https://github.com/OmniacDev/mcbe-ipc.git"

0 commit comments

Comments
 (0)
Please sign in to comment.