Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

WIP: Use the base class #41

Merged
merged 5 commits into from
Nov 28, 2016
Merged

WIP: Use the base class #41

merged 5 commits into from
Nov 28, 2016

Conversation

daviddias
Copy link
Collaborator

@daviddias daviddias commented Nov 26, 2016

This makes libp2p bundles so simple!

ref: libp2p/js-libp2p#43

return this.swarm.unhandle(protocol)
const libp2p = require('libp2p')

class Node extends libp2p.Node {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes inheritance is just awesome :)

@daviddias
Copy link
Collaborator Author

It works \o/ So happy about this refactoring, makes things so much nicer and understandable

@dignifiedquire Not sure if I should consider your comment as a positive CR, but I believe it is safe to assume that if you found an issue, you would comment right away :) Will merge once CI is green

@dignifiedquire
Copy link
Contributor

@diasdavid I didn't do any real CR yet will do tomorrow

@daviddias
Copy link
Collaborator Author

thank you :)

@daviddias
Copy link
Collaborator Author

while you are at it :) ipfs-inactive/js-libp2p-ipfs-browser#126

this.routing = null
this.records = null
module.exports = {
Node: Node
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just module.exports = Node

Copy link
Collaborator Author

@daviddias daviddias Nov 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, my thinking is that spawning new libp2p.Node is more intuitive than spawning new Libp2p, would you agree?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specially in a library that its name is an ecosystem of stuff connecting to other stuff (abstraction ⛰ )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really, I would just like to write

const Node = require('libp2p-ipfs')

const myNode = new Node()

Copy link
Collaborator Author

@daviddias daviddias Nov 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"fine :D"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done :)

@daviddias daviddias merged commit acce544 into master Nov 28, 2016
@daviddias daviddias deleted the feat/use-base-libp2p branch November 28, 2016 10:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants