add subject function binders

This commit is contained in:
Stewart Allen 2021-12-09 21:55:16 -05:00
commit dc2b0e014f
2 changed files with 9 additions and 1 deletions

View file

@ -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(),

View file

@ -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);
}
}
}