cleaned up the component 'relay' api

This commit is contained in:
Geoff Doty 2018-11-29 21:53:14 -05:00
parent 1e54819b8e
commit 2b84e3c469
1 changed files with 7 additions and 7 deletions

View File

@ -1,15 +1,15 @@
// https://stackoverflow.com/questions/26251773/knockout-components-communication // https://stackoverflow.com/questions/26251773/knockout-components-communication
define(['knockout'], function(ko) { define(['knockout'], function(ko) {
"use strict"; 'use strict';
var e = new ko.subscribable(); var evt = new ko.subscribable();
return { return {
on: function(handler, topic) { inbound: function(handler, topic) {
e.subscribe(handler, null, topic); evt.subscribe(handler, null, topic);
}, },
trigger: function(message, topic) { outbound: function(message, topic) {
e.notifySubscribers(message, topic); evt.notifySubscribers(message, topic);
} }
} };
}); });