add subject function binders
This commit is contained in:
parent
955d9b9a3f
commit
dc2b0e014f
2 changed files with 9 additions and 1 deletions
|
|
@ -16,7 +16,7 @@
|
|||
SETUP = parseOpt(LOC.search.substring(1)),
|
||||
SECURE = isSecure(LOC.protocol),
|
||||
LOCAL = self.debug && !SETUP.remote,
|
||||
EVENT = new Broker(),
|
||||
EVENT = KIRI.broker = new Broker(),
|
||||
SDB = MOTO.KV,
|
||||
ODB = KIRI.odb = new MOTO.Storage(SETUP.d ? SETUP.d[0] : 'kiri'),
|
||||
// K3DB = KIRI.wdb = new MOTO.Storage('kiri3', { stores:["file","work"] }).init(),
|
||||
|
|
|
|||
|
|
@ -46,4 +46,12 @@ class Broker {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return function bound to a topic
|
||||
bind(topic, message, options) {
|
||||
let broker = this;
|
||||
return function(msg = message, opt = options) {
|
||||
broker.publish(topic, msg, opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue