Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #70

Open
1 task
metasean opened this issue Jul 8, 2015 · 48 comments
Open
1 task

Documentation #70

metasean opened this issue Jul 8, 2015 · 48 comments

Comments

@metasean
Copy link
Collaborator

metasean commented Jul 8, 2015

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 2. Need examples for each Gun option.

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 3. Need comment next to each Gun example briefly explaining that code

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 4. "var gun = Gun({file: 'data.json'}) to change the name of the file that gets dumped to. Warning! The file module is the server's default persistence, and should only be used for local development testing only!" should be "var gun = Gun({file: 'data.json'}) to change the name of the file that gets dumped to. Warning! The file module is the server's default persistence, and should only be used for local development testing!" OR "var gun = Gun({file: 'data.json'}) to change the name of the file that gets dumped to. Warning! The file module is the server's default persistence, and should be used for local development testing only!"

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 5. "... on the server dumps to AWS S3, this is the preferred persistence layer." is not clear. What exactly are "server dumps"? What are the other persistence layer options? Do ' ' need to be filled in for all three object keys? Should users actually be filling in the AWS S3 key information in their JS code?

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 6. RE: "object is a javascript {obj:'ect'}, it can be deeply nested, be a partial, or have circular references in it, but it cannot have the following values inside of it: undefined, Infinity, NaN, []." Again, what is the "ect" in "{obj:'ect'}"? Can an object be both deeply nested and have circular references? I understand that the object keys can not be undefined, Infinity, NaN, [], but why can't the object values be undefined, Infinity, NaN, []?

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 7. Under the put section, the no, one, and many should be no peers, one peer, and many peers for clarity. (Yes it does become clear, but readers have additional cognitive load as they try to figure out what you are referring to, when they would be better spending their cognitive cycles on why you're telling them.

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 8. RE: "options is an {obj:'ect'}, no options are currently available except maybe hook specific.", specifically "...no options...except maybe..." - confusing department of confusion - a better option would be along the lines of, "options is an {keys:'values'}, currently there are no options in gun core, but specific hook implementations may have options."

@metasean metasean changed the title Documentation clarity issue Documentation clarity issues Jul 8, 2015
@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 9. "gun.put({hello: "world"}) blindly fire and forget." should have some caveat that there isn't a key (i.e. the "forget" part, and best practice is to have a key

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 10. RE: "Graph based data" ... "both objects get saved into a graph." The "both parts" section should be moved above the code sample. The "Graph based data" as a title is useful, but (a) slightly more explanation before the code, of what the reader should be focusing on, would be useful, (b) the current "both objects" section is visually lost under the code block, and (c) picking up mid-sentence after the code block is cognitively jarring

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 11. "options as a 'string' is a soul that you forcibly want to associate the key with, ignoring the current context that key is chained on." - "soul" hasn't been mentioned on this page before. A brief explanation and link to more info is appropriate.

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 12. "gun.put({hello: "world"}).key('message/from/thedoctor') blindly fire and forget." Since it has a key, it isn't being forgotten like a key-less put is; it is much more a "update the object and assign it this key, so that it can be easily referenced".

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 13. "Opens up a gun reference to the root object you had saved to that key. It will load the node so you can further manipulate it." - The first sentence is unnecessarily verbose. This is due, in part, to the fact that the page doesn't presume knowledge of gun nodes. I think it may be best to have a brief primer on (a) gun nodes, (b) trees in gun, (c) circular references in gun, and (d) gun souls either at the beginning of the page or, preferably, as a separate page. Then the first sentence could simple read, "Accesses the keyed gun node for further operations.." This also address the bullet above about "soul" not having been mentioned.

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 14. "callback is a function(){} which gets called as callback(err, graph) used for err handling and the raw graph. Note that you do not want to use this callback for every day development, as it gets called repeatedly to comply the wire protocol. Use on or val instead, they are convenience methods, this callback is for hooks and extensions." should be "callback is a function(){} which gets called as a callback(err, graph) and is used for err handling and the raw graph. Note that this callback is repeatedly called, therefore it shouldn't be used for everyday development. Instead, use on or val, as they are optimized for application use, while the gun callback is engineered primarily for hooks and extensions."

Same comments apply to get and path.

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 15. "options.force as true to pull from the local persistence layer or a peer rather than memory." Should briefly state the pros and cons, or at the least why a programmer should prefer one over the other. It's alluded to in an example, but users shouldn't have to read through the example to get basic info such as this.

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 16. "options as true aggregates into an {obj:'ect'} with" Do what? I'm not even sure what you're trying to say here.

Applies to both get and map.

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 17. "options.change as true makes data only have the delta difference of the change that happened, rather than the full node again and again." Isn't this the default behavior?

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 18. In the on examples, it would be nice to have longer comment sections and make a clear delineation of what data is being received in each round.

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 19. "gun.get('user/thedoctor').val() will automatically console.log, for easy debugging purposes." Does on also console.log? if not, why not? (feels like an arbitrary 'good for the goose but not the gander distinction.)

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 20. "Traverses into the fields on the path, which allow you to explore the nested objects, relations, and values from the perspective of the root node that was given a key." Reads like word spaghetti. "Traverses a path's fields, allowing exploration of nested objects, relations, and values starting at the key's root node.

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 21. "Gives us just the phone number and whenever it changes." sounds like it gives the phone number and then a timestamp, and only a timestamp, when it is modified. Should be something like, "Responds with the current phone number and updates when the phone number is modified."

@metasean
Copy link
Collaborator Author

metasean commented Jul 8, 2015

  • 22. For map examples, the examples need some type of title, or other preparatory text, e.g. map without on or val.

This was referenced Jul 8, 2015
Closed
@rootsical
Copy link

would be good to know if the functions return anything, if at all.. thanks

@amark
Copy link
Owner

amark commented Nov 26, 2015

All API methods should return a gun reference context that you can chain off of. Or were you talking about other functions?

@rootsical
Copy link

thanks. will ask a follow up question on gitter if that's ok..

@amark
Copy link
Owner

amark commented Nov 26, 2015

Yupe. :)

@amark
Copy link
Owner

amark commented Feb 20, 2017

Docs have now been rewritten like... 2 or 3 times since July 2015? Definitely all could be improved, but I'm gonna say it is safe to close this issue. If there are still problems:

Please feel free to contribute and improve the docs (they are a wiki)! Or asking questions on Stackoverflow tagged "gun" is great. And help on gitter.

gun.js.org website needs updated docs though. Will probably add some JS there that auto-pulls from github's wiki API so it is always recent. But that is a separate thing, so I'm gonna close this one, now finally! But PLEASE do complain/help/contribute to doc clarity.

@amark amark closed this as completed Feb 20, 2017
@amark
Copy link
Owner

amark commented Feb 20, 2017

Looks like this was being used to cover ALL core documentation clarity. Woops! So I'm gonna keep it open for future use instead.

@amark amark reopened this Feb 20, 2017
@amark amark changed the title Documentation clarity issues Documentation Feb 20, 2017
@KhaledElAnsari
Copy link

KhaledElAnsari commented Dec 15, 2017

there's no content for gun.chain, I don't know if it's missing or removed

@amark
Copy link
Owner

amark commented Dec 15, 2017

@KhaledElAnsari good observation!

I'll add that to the TODO list of things to address in the documentation.

It still exists, but end-user-developers don't really need to use it, but it should still be documented! If you have any specific question about it right now I can try to answer it.

@KhaledElAnsari
Copy link

KhaledElAnsari commented Dec 15, 2017

I'm still reading about Gun, hopefully I can use it in my next project. good job by the way

@plentylife
Copy link

In the docs, regarding the constructor it states:

the previous options are actually aggregated into an object, which you can pass in yourself.
options.peers is an object, where the URLs are properties, and the value is an empty object.

That is not actually true. The object must NOT be empty, it must be in the format of {url: "your_url"}

@amark
Copy link
Owner

amark commented Feb 19, 2018

@plentylife yeah some meta-data got added to the peer objects since then, they look more like this:

{
  peers: {
    'http://localhost:8080/gun': {
      url: 'http://localhost:8080/gun',
      wire: __rawSocket
    }
  }
}

Now note, you do not have to pass it like that it just upgrades internally into an object that is represented like that.

If you see anything that is wrong in the docs, https://github.com/amark/gun/wiki/API is a wiki that can be edited, so feel free to improve it for everybody!

@plentylife
Copy link

@amark I couldn't get it to work, unless I passed it with a url property filled in.

@feat7
Copy link

feat7 commented Jul 6, 2018

@amark The docs say we can use Gun(['http://server1.com/gun', 'http://server2.com/gun'])
But this doesn't give any idea how to set up those servers for gun. A little more explanation is necessary.
Also, if not sure if we can use server.com/gun1, server1.com/gun2

@thoka
Copy link
Contributor

thoka commented Jul 7, 2018

wouldnt it be better to have monothematic issues on documentation, marked with a label "documentation" ?

@amark
Copy link
Owner

amark commented Jul 8, 2018

@feat7 server1.com/gun was suppose to be an example URL, not a real/actual URL. Fair point though, when we launch AXE hopefully we can update this with real URLs that anybody can use. https://gun.eco/docs/Installation#node should have some more info on how to setup - do those docs (and related pages) help at all, or need changes?

@thoka monothematic? I'm not sure what you mean, but sure! I think you have contributor access/rights? If not, I can give them to you, to help change whatever needs to be changed to make things better :)

@thoka
Copy link
Contributor

thoka commented Jul 10, 2018

@amark monothematic: one issue <=> one topic
contributor rights: not yet

@AlexYegupov
Copy link

AlexYegupov commented Jul 24, 2018

Seems like constructor params at the gunjs-notes-app/server.js example
Gun({ file: 'db/data.json', web: server });
differs from the described at the docs
https://github.com/amark/gun/wiki/API#options

Neither 'file' parameter nor 'web' one.. Seems confusing especially for the basic example.

@mitra42
Copy link

mitra42 commented Jul 24, 2018

I've found many similar discrepancies - and asked @amark about them a couple of days ago before he went on vacation. If I understood correctly he suggested adding discrepancies to the Wiki and he'd edit/correct them later.

The most common I've found are additional optional arguments (such as this case).

@bugs181
Copy link
Contributor

bugs181 commented Dec 18, 2018

I would also gladly accept contrib rights as well to help clarify and organize documentation structure.

@Dletta
Copy link
Contributor

Dletta commented Dec 18, 2018

@bugs181 Docs are all openly editable via the Wiki here in Github.

@bugs181
Copy link
Contributor

bugs181 commented Dec 18, 2018

@Dletta There were a couple other things I thought I could help out with. Mostly cleaning up Git issues. I see a lot of users asking questions but their Markdown skills are limited. I could clean these issues up to be more readable as well.

@leocrawford
Copy link

Not sure if it is a bug or documentation fault, but back(0) returns the same result as back(1) which isn't as documented (or expected)

@leocrawford
Copy link

The semantics of map/on/once are not entirely clear. In particular it seems that a chain of gets with a single on at the end, will get updates/modification/deletions of final item in chain, but only additions to chain as a whole.
It would be good to know if there was a preferred way of looking for changes to any of the chain.

@davidbludlow
Copy link

davidbludlow commented Apr 5, 2023

  • The use of "TBD" in https://gun.eco/docs/API is vague. Have those things been programmed? If so have their API's been stabilized? Or does "TBD" mean "To Be Deprecated"?

My guess would be that it would mean that they haven't been programmed yet, but I really don't think that is true. If it is true, then that idea should be conveyed in a less ambiguous way.

@amark
Copy link
Owner

amark commented May 11, 2023

@davidbludlow good point! create/auth/recall should be stable, the others removed until future notice. Please help and delete them: https://github.com/amark/gun/wiki

@koh-osug
Copy link

koh-osug commented Jan 7, 2024

The example can be misleading to beginners:

gun.opt({peers: ['http://server1.com/gun', 'http://server2.com/gun']}); // re-add peers to GUN-options

gun.get('heartbeat').put("heartbeat") // optional: tell GUN to put something small, forcing GUN to establish connection, as GUN is lazy by nature to make it save on data transfer.

This throws :

Data at root of graph must be a node (an object).

If the database is empty, so here an object should be used, e.g.: gun.get('heartbeat').put({alive: true})

@koh-osug
Copy link

koh-osug commented Jan 8, 2024

The Gunconstructor documentation does not specify the web property. Without this being documented it is super hard to find out the a webrtc server must be started in a node environment to get things working like this:

    const server = createServer()

    const host = 'localhost'
    const port = 9999
    const gun = Gun({web: server});

    server.listen(port, () => {
        console.info(
            'Gun server started on port ' + port + ' with /gun',
        )
    })
  • Added to the constructor API documentation also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

15 participants