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
|
// 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);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
});
|
});
|
Loading…
Reference in New Issue