This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-17
lines changed Expand file tree Collapse file tree 1 file changed +21
-17
lines changed Original file line number Diff line number Diff line change @@ -361,24 +361,28 @@ This method is asynchronous. There are several ways to be notified when the node
361
361
```js
362
362
const node = new IPFS({ start: false })
363
363
364
- // Use a promise:
365
- node .start ()
366
- .then (() => console .log (' Node started!' ))
367
- .catch (error => console .error (' Node failed to start!' , error))
368
-
369
- // OR use a callback:
370
- node .start (error => {
371
- if (error) {
372
- console .error (' Node failed to start!' , error)
373
- return
374
- }
375
- console .log (' Node started!' )
376
- })
364
+ node .on (' ready' , () => {
365
+ console .log (' Node is ready to use!' )
366
+
367
+ // Use a promise:
368
+ node .start ()
369
+ .then (() => console .log (' Node started!' ))
370
+ .catch (error => console .error (' Node failed to start!' , error))
371
+
372
+ // OR use a callback:
373
+ node .start (error => {
374
+ if (error) {
375
+ console .error (' Node failed to start!' , error)
376
+ return
377
+ }
378
+ console .log (' Node started!' )
379
+ })
377
380
378
- // OR use events:
379
- node .on (' error' , error => console .error (' Something went terribly wrong!' , error))
380
- node .on (' start' , () => console .log (' Node started!' ))
381
- node .start ()
381
+ // OR use events:
382
+ node .on (' error' , error => console .error (' Something went terribly wrong!' , error))
383
+ node .on (' start' , () => console .log (' Node started!' ))
384
+ node .start ()
385
+ })
382
386
```
383
387
384
388
#### ` node.stop([callback]) `
You can’t perform that action at this time.
0 commit comments