Created
February 9, 2020 20:22
-
-
Save highruned/f9353c4bc9c879c6129b1a34d5008a74 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
const observables: any = {} | |
const subjects: any = {} | |
observables.log = Observable.create(subject => { | |
subjects.log = subject | |
}) | |
function log(...msgs) { | |
console.log(...msgs) | |
if (subjects.log) { | |
subjects.log.next(msgs) | |
} | |
} | |
export async function init() { | |
return { | |
name: 'crypto', | |
observables, | |
} | |
} |
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
export async function init() { | |
for (const brain of brains) { | |
const res = await brain.init() | |
if (res && res.observables && res.observables.log) { | |
res.observables.log.subscribe(function(msgs) { | |
db.logs.insert({ brain: res.name, messages: msgs }) | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment