This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*so let's simplify you have | |
- your letters (all messages, yours & other peer) which you draw to DOM | |
- you have your outbox , when you say something, that the other person listens to with .on(...) | |
and adds to their letters when they arrive | |
- you listen with .on(...) the other peers messages and add them to letters when | |
they arrive | |
- on your send(){...} you would add the message to your letters | |
and to the outbox so your message can trigger the other persons .on */ | |
class Chat { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const fs = require('fs'); | |
const tape = require('tape'); | |
const _test = require('tape-promise').default // <---- notice 'default' | |
const test = _test(tape) // decorate tape | |
const Gun = require('../gun') | |
require('../gun/sea') | |
require('../gun/lib/then.js') | |
require('../gun/lib/promise.js') | |
const mkdirp = require('mkdirp'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function importGUN3 (data, options){ | |
options = options || {}; | |
options.prefix = 'gun/'; | |
if(options.arrays !== false){ | |
options.arrays = true; | |
data = array2object(data); | |
} | |
var drift = options.state || Gun.time.now(); | |
var ctx = {}, at = {}; | |
Gun.ify(data, function(env, cb, map){ |