cleaned up the component 'relay' api
This commit is contained in:
parent
1e54819b8e
commit
2b84e3c469
|
@ -1,15 +1,15 @@
|
|||
// https://stackoverflow.com/questions/26251773/knockout-components-communication
|
||||
define(['knockout'], function(ko) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var e = new ko.subscribable();
|
||||
var evt = new ko.subscribable();
|
||||
|
||||
return {
|
||||
on: function(handler, topic) {
|
||||
e.subscribe(handler, null, topic);
|
||||
inbound: function(handler, topic) {
|
||||
evt.subscribe(handler, null, topic);
|
||||
},
|
||||
trigger: function(message, topic) {
|
||||
e.notifySubscribers(message, topic);
|
||||
}
|
||||
outbound: function(message, topic) {
|
||||
evt.notifySubscribers(message, topic);
|
||||
}
|
||||
};
|
||||
});
|
Loading…
Reference in New Issue