You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
refactor: remove proxy api object and detect initialisaion state
Ask the repo if it has been initialised, if so, allow the user to
skip the `.init()` step and move on to `.start()`
Removes the proxy api object in favour of vanilla functions because
it was causing errors to be thrown if you even referenced properties
that were from a different api state.
E.g. with an unitialised repo:
```javascript
const ipfs = await IPFS.create({
init: false,
start: false
})
// no invocation, just referencing the property causes an error to be thrown
console.info(ipfs.start)
```
I'd looked at changing the proxy behaviour to return a function that
throws if invoked, but at the time the proxy is called you don't know
what the calling code is going to do with the return value so it's hard
to know if it's accessing a function or a property - the return value is
just put on the stack and interacted with so it seemed simpler to just
pull it out and define the API up front.
A nice future improvement might be to have `.init`, `.start` and `.stop`
export functions that update the API - that way after `.stop` has been
invoked, it could restore the API from the post-`.init` state, but this
can come later.
Also upgrades `ipfsd-ctl` to pass refs only during factory creation.
Depends on:
- [ ] ipfs/js-ipfsd-ctl#457
- [ ] ipfs/js-ipfs-repo#219
- [ ] ipfs-inactive/npm-go-ipfs-dep#40
0 commit comments