diff --git a/README.md b/README.md index a0b470dc..b4cd2e69 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ GUN is a realtime, distributed, offline-first, graph database engine. Doing **[2 ## Why? - - **Realtime** - You might use socketio for realtime updates, but what happens if you reload the page? GUN solves *state synchronization* for you, no matter what, on reloads, across all your users, and even on conflicting updates. + - **Realtime** - You might use Socket.IO for realtime updates, but what happens if you reload the page? GUN solves *state synchronization* for you, no matter what, on reloads, across all your users, and even on conflicting updates. - **Distributed** - GUN is peer-to-peer by design, meaning you have no centralized database server to maintain or that could crash. This lets you sleep through the night without worrying about database DevOps - we call it "NoDB". From there, you can build decentralized, federated, or centralized apps. - **Offline-first** - GUN works even if your internet or cell reception doesn't. Users can still plug away and save data as normal, and then when the network comes back online GUN will automatically synchronize all the changes and handle any conflicts for you. - **Graph** - Most databases force you to bend over backwards to match their storage constraints. But graphs are different, they let you have any data structure you want. Whether that be traditional tables with relations, document oriented trees, or tons of circular references. You choose. @@ -204,7 +204,7 @@ Or, if you prefer your Docker image with metadata labels (Linux/Mac only): ```bash npm run docker -docker run -p 8080:8080 usenameHere/gun:git +docker run -p 8080:8080 username/gun:git ``` Then visit [http://localhost:8080](http://localhost:8080) in your browser. diff --git a/gun.js b/gun.js index 32f1180b..fbcad115 100644 --- a/gun.js +++ b/gun.js @@ -1209,10 +1209,10 @@ ;USE(function(module){ var Gun = USE('./root'); Gun.chain.get = function(key, cb, as){ - var gun; + var gun, tmp; if(typeof key === 'string'){ var back = this, cat = back._; - var next = cat.next || empty, tmp; + var next = cat.next || empty; if(!(gun = next[key])){ gun = cache(key, back); } @@ -1233,6 +1233,9 @@ } else if(num_is(key)){ return this.get(''+key, cb, as); + } else + if(tmp = rel.is(key)){ + return this.get(tmp, cb, as); } else { (as = this.chain())._.err = {err: Gun.log('Invalid get request!', key)}; // CLEAN UP if(cb){ cb.call(as, as._.err) } diff --git a/lib/time.js b/lib/time.js index 49781786..8fb429ce 100644 --- a/lib/time.js +++ b/lib/time.js @@ -1,3 +1,7 @@ +if(typeof window === "undefined"){ //Not in the browser, Include from node + var Gun = require('gun/gun'); +} + ;(function(){ var ify = Gun.node.ify, u; Gun.chain.time = function(data, a, b){ @@ -139,4 +143,4 @@ at = at.slice(-7); return new Date(Date.UTC(at[0], parseFloat(at[1])-1, at[2], at[3], at[4], at[5], at[6])); } -}()); \ No newline at end of file +}());