mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
gun slinger!
This commit is contained in:
parent
2a8f64a4b9
commit
8d1ec10375
@ -35,8 +35,9 @@
|
||||
z-index: 9999;
|
||||
background: brown;
|
||||
color: white;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 1024px;
|
||||
height: 100%;
|
||||
}
|
||||
.player input, .player button {
|
||||
font-size: 18pt;
|
||||
@ -45,7 +46,6 @@
|
||||
padding: .2em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="duel" class="none fight">
|
||||
<center>
|
||||
<h2>GET READY!</h2>
|
||||
@ -67,13 +67,16 @@
|
||||
</form>
|
||||
<span><b>Last duel won by <span name="last">no one</span> in <span name="ended">0</span> seconds against <span name="loser">nobody</span>.</b></span>
|
||||
</div>
|
||||
<textarea id="debug" style="position: fixed; bottom: 0; width: 100%; height: 5em; z-index: 99999999999;"></textarea>
|
||||
<script>
|
||||
console._log = console.log;console.log = function(a,s,d,f){ var arg = arguments, s = '';
|
||||
for(var i in arg){ var val = arg[i]; if(typeof val == 'string'){ s += val + ' ' } else { s += JSON.stringify(val) + ' ' } }; $("#debug").prepend(s + '\n\n') }
|
||||
$(function(){
|
||||
var me = window.me = {},
|
||||
game = window.game = {},
|
||||
gun = window.gun = Gun([location.origin + '/gun'])
|
||||
//gun = window.gun = Gun([location.origin + '/gun'])
|
||||
//gun = window.gun = Gun(['http://localhost:8888/' + 'gun'])
|
||||
//gun = window.gun = Gun(['http://gunduel.t.proxylocal.com/' + 'gun'])
|
||||
gun = window.gun = Gun(['https://gunjs.herokuapp.com/gun'])
|
||||
.load('game/duel', function(data){
|
||||
console.log(data);
|
||||
$(document).on('submit', '.player', function(e){
|
||||
|
@ -9,7 +9,7 @@
|
||||
, "dependencies": {
|
||||
"express": "~>4.9.0",
|
||||
"body-parser": "~>1.8.1",
|
||||
"gun": "0.0.6-d"
|
||||
"gun": "0.0.6-e"
|
||||
}
|
||||
, "scripts": {
|
||||
"start": "node app.js",
|
||||
|
7
gun.js
7
gun.js
@ -129,7 +129,6 @@
|
||||
Gun.chain.get = function(cb){
|
||||
var gun = this;
|
||||
gun._.events.on(gun._.events.trace += 1).event(function(node){
|
||||
console.log("BOOM got it", node);
|
||||
if(gun._.field){
|
||||
return cb.call(gun, (node||{})[gun._.field]); // copy data first?
|
||||
}
|
||||
@ -697,14 +696,14 @@
|
||||
Gun.obj.del(tab.set.defer, id); // handle err with a retry? Or make a system auto-do it?
|
||||
if(!body){ return }
|
||||
if(body.defer){
|
||||
console.log("deferring post", body.defer);
|
||||
//console.log("deferring post", body.defer);
|
||||
tab.set.defer[body.defer] = respond;
|
||||
}
|
||||
if(body.reply){
|
||||
respond(null, {headers: reply.headers, body: body.reply });
|
||||
}
|
||||
if(body.refed){
|
||||
console.log("-------post-reply-all--------->", reply, err);
|
||||
console.log("-------post-reply-all--------->", 1 || reply, err);
|
||||
Gun.obj.map(body.refed, function(r, id){
|
||||
var cb;
|
||||
if(cb = tab.set.defer[id]){
|
||||
@ -741,7 +740,7 @@
|
||||
console.log(err, reply);
|
||||
return;
|
||||
}
|
||||
console.log("poll", reply);
|
||||
console.log("poll", 1 || reply);
|
||||
tab.subscribe.poll();
|
||||
if(reply.headers){
|
||||
tab.subscribe.sub = reply.headers['gun-sub'] || tab.subscribe.sub;
|
||||
|
@ -1,5 +1,5 @@
|
||||
{ "name": "gun"
|
||||
, "version": "0.0.6-d"
|
||||
, "version": "0.0.6-e"
|
||||
, "author": "Mark Nadal"
|
||||
, "description": "Graph engine."
|
||||
, "engines": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user