This repository has been archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
After installation if you wish to specify a path to the installed binary, it's useful for this module to be able to tell the world where it put the binary, so this PR adds `.path` and `.path.silent()` functions to do that. This way we can use the installed module without having to rely on any external context or platform.
alanshaw
approved these changes
Feb 6, 2020
hugomrdias
approved these changes
Feb 9, 2020
achingbrain
added a commit
to ipfs/js-ipfs
that referenced
this pull request
Feb 10, 2020
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
3 tasks
Released as |
achingbrain
added a commit
to ipfs/js-ipfs
that referenced
this pull request
Feb 13, 2020
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 fix: do not allow parallel init, start or stop If the user is calling `.init`, `.start` or `.stop` from the code in multiple places simultaneously, they probably have a bug in their code and we should let them know instead of masking it.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After installation if you wish to specify a path to the installed binary, it's useful for this module to be able to tell the world where it put the binary, so this PR adds
.path
and.path.silent()
functions to do that.This way we can use the installed module without having to rely on any external context or platform.
Also adds a step to skip re-downloading binaries when they have already been downloaded.