下面的Node callback
onNeDB
工作正常,
Datastore = require 'nedb'
db = new Datastore
db.insert a: 'Hi!', (err, docs) ->
console.log docs
然后尝试转换NeDB Node callback
为Bacon EventStream
,
Bacon = require('baconjs').Bacon
Datastore = require 'nedb'
db = new Datastore
insert = Bacon.fromNodeCallback db.insert, a: 'Hi!'
insert.onValue (docs) ->
console.log docs
为什么它在下面失败了?
TypeError: Cannot call method 'push' of undefined