@@ -12,13 +12,13 @@ processes. When you update that object, it updates the equivalent accordingly. A
1212also delete the equivalent. This works both ways, so if you change the equivalent object in a subprocess, the original
1313will be changes as well.
1414
15- # Install
15+ ## Install
1616
1717``` shell
1818npm i ipos
1919```
2020
21- # Usage
21+ ## Usage
2222
2323In the main process:
2424
@@ -51,7 +51,7 @@ See [`example/main-process.js`](https://github.com/drinking-code/inter-process-o
5151and [ ` example/sub-process.js ` ] ( https://github.com/drinking-code/inter-process-object-sharing/blob/main/example/sub-process.js )
5252.
5353
54- ## A note on class instances
54+ ### A note on class instances
5555
5656To synchronise class instances, you first have to register the class with ipos _ on each process_ (on which the class
5757instance does not yet exist) before the synchronisation happens. That means if you want to connect two IPOS instances,
@@ -106,12 +106,12 @@ const ipos = IPOS.registerClass(Example)
106106const ipos = await IPOS .new ()
107107```
108108
109- ## ` IPOS() `
109+ ### ` IPOS() `
110110
111111The main class. Don't use the ` new ` keyword (when creating an instance in a subprocess). Instead, use the
112112static [ ` IPOS.new() ` ] ( #static-iposnew-ipos--promiseipos ) method to create an instance.
113113
114- ### ` static IPOS.new(): IPOS | Promise<IPOS> `
114+ #### ` static IPOS.new(): IPOS | Promise<IPOS> `
115115
116116Creates a new instance. Multiple instances are not yet supported, so only create one instance per process.
117117
@@ -121,7 +121,7 @@ Creates a new instance. Multiple instances are not yet supported, so only create
121121- ` Promise<IPOS> ` , if called in a subprocess.
122122 Use await to wait for the connection to the main process to be established.
123123
124- ### ` ipos.addProcess(process: ChildProcess): Promise<void> `
124+ #### ` ipos.addProcess(process: ChildProcess): Promise<void> `
125125
126126Connect a subprocess to the IPOS instance. The subprocess must also
127127call [ ` IPOS.new() ` ] ( #static-iposnew-ipos--promiseipos ) for the two processes' IPOS to connect.
@@ -133,7 +133,7 @@ call [`IPOS.new()`](#static-iposnew-ipos--promiseipos) for the two processes' IP
133133
134134** Returns:** ` Promise<void> ` . Use await to wait for the connection to the subprocess to be established.
135135
136- ### ` ipos.removeProcess(process: ChildProcess): boolean `
136+ #### ` ipos.removeProcess(process: ChildProcess): boolean `
137137
138138Disconnect a subprocess to the IPOS instance. Closed subprocess automatically get disconnected.
139139
@@ -145,7 +145,7 @@ Disconnect a subprocess to the IPOS instance. Closed subprocess automatically ge
145145** Returns:** ` boolean ` . ` true ` if a process was connected and has been disconnected, or ` false ` if the process was not
146146connected.
147147
148- ### ` ipos.create(key: string, value: any) `
148+ #### ` ipos.create(key: string, value: any) `
149149
150150Create a field on the IPOS instance. This value can later be accessed or updated (See
151151[ ` ipos.get() ` ] ( #iposgetkey-string-any ) ). After creating a field, you can access and update it (even change the type)
@@ -164,7 +164,7 @@ console.log(sharedObject.myValue) // -> 'foo'
164164- ` key: string ` A unique key.
165165- ` value: any ` The value to be stored.
166166
167- ### ` ipos.get(key: string): any `
167+ #### ` ipos.get(key: string): any `
168168
169169Get an already created field from the IPOS instance. You can also use ` ipos[key: string] ` to access the value. If you
170170use a method on the value that changes the value, this change will also be reflected in the connected IPOS instances.
@@ -189,7 +189,7 @@ console.log(sharedObject.myArray) // -> ['myString']
189189
190190** Returns:** ` any ` . The stored value.
191191
192- ### ` ipos.delete(key: string): boolean `
192+ #### ` ipos.delete(key: string): boolean `
193193
194194Deletes the field with the specified key.
195195
@@ -199,9 +199,9 @@ Deletes the field with the specified key.
199199
200200** Returns:** ` boolean ` . ` true ` if a field existed and has been removed, or ` false ` if the element does not exist.
201201
202- # Testing
202+ ## Testing
203203
204- ## Glossary of terms
204+ ### Glossary of terms
205205
206206- ** "Synchronise"** a field: _ Creating a main instance, then adding a field before connecting to a child instance._ The
207207 field will be transmitted along with any other fields that may have been created during the connection process
0 commit comments