From 302931bfafe607c942ef9f5505ddf9d1a98f7421 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sun, 26 Dec 2021 13:09:07 -0500 Subject: [PATCH] api backward compatibly event chaining --- src/kiri/main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/kiri/main.js b/src/kiri/main.js index 7ae2e4bf..4952de67 100644 --- a/src/kiri/main.js +++ b/src/kiri/main.js @@ -59,6 +59,12 @@ // add show() to catalog for API CATALOG.show = showCatalog; + // patch broker for api backward compatibility + EVENT.on = (topic, listener) => { + EVENT.subscribe(topic, listener); + return EVENT; + }; + const PMODES = { SPEED: 1, TOOLS: 2 @@ -307,7 +313,7 @@ file: showHelpFile }, event: { - on: (t,l) => { EVENT.subscribe(t,l) }, + on: (t,l) => { return EVENT.on(t,l) }, emit: (t,m,o) => { EVENT.publish(t,m,o) }, bind: (t,m,o) => { return EVENT.bind(t,m,o) }, import: loadFile,