Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Run example constructor #34

Open
RichardLitt opened this issue May 2, 2019 · 2 comments
Open

Run example constructor #34

RichardLitt opened this issue May 2, 2019 · 2 comments
Labels
bug Something isn't working Tutorial

Comments

@RichardLitt
Copy link
Contributor

I've created a file, test.js:

const NPP = require('./newpieceplease')

NPP.onready = () => {
   console.log(NPP.orbitdb.id)
}

And I include the constructor. How do I call onready? What steps do I need more?

@RichardLitt
Copy link
Contributor Author

Also:

When you ran the code in Node.js, you created two folders in your project structure: 'orbitdb/ and ipfs/.

This didn't happen for me. What am I missing?

@aphelionz aphelionz added bug Something isn't working Tutorial labels Apr 5, 2020
@kvutien
Copy link

kvutien commented Jun 24, 2021

Excellent question, @RichardLitt , thanks for asking.

I'm doing the tutorial myself as a totally newbie to IPFS and OrbitDB. And I'm also redoing for my own usage the 01_Basics.md, eventually for a PR.

Here is a transcript of what I did, along with the output (disregard the undefined, it's coming from the JavaScript evaluator)

kvutien@VTKT5 orbitdb-ch1 % node
   Welcome to Node.js v12.18.4.
   Type ".help" for more information.
> const NPP = require('./newpieceplease')
   undefined
> NPP.onready = () => {console.log(NPP.orbitdb.id)}
   [Function]
> NPP.create()
   Promise { <pending> }
   > IPFS node's id:  03ecc23e7dfa8d1837ba979e719e934879c80dbd62fa0f42c84093f3ae53090e86
> NPP.onready()
   QmfEUEbNaTLRgLEFg6641e2ZzwWTRoY3iguwiCaqzu9W21
   undefined

Note: the output line after "Promise" is a console.log I added for my own usage.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Tutorial
Projects
None yet
Development

No branches or pull requests

3 participants