Last active
October 12, 2017 06:17
-
-
Save gblok/d5447a1ad820bcaf5eaf95d9dc80646f to your computer and use it in GitHub Desktop.
This file contains 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
import Gun from 'gun/gun' | |
localStorage.clear() | |
const guid = () => [2,1,1,1,3].map(n => Array.from(Array(n), () => Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1)).join('')).join('-') | |
const gun = new Gun | |
const notes = gun.get('notes') | |
notes.map().on((id, name) => console.log('ls', id, name)) | |
function AddItem(key) { | |
let id = guid() | |
notes.get(id).put({key, id}) | |
} | |
Array.from(Array(5).keys()).filter(Boolean).forEach(AddItem) | |
///map().on() why return multi one item entry? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment