web: export notification
This commit is contained in:
parent
15e292b894
commit
42d8258309
31
doric-web/dist/index.js
vendored
31
doric-web/dist/index.js
vendored
@ -1312,6 +1312,17 @@ var doric = (function (exports) {
|
||||
register(instance) {
|
||||
this.entity = instance;
|
||||
}
|
||||
function2Id(func) {
|
||||
const functionId = uniqueId('function');
|
||||
this.callbacks.set(functionId, {
|
||||
resolve: func,
|
||||
reject: () => { loge("This should not be called"); }
|
||||
});
|
||||
return functionId;
|
||||
}
|
||||
removeFuncById(funcId) {
|
||||
this.callbacks.delete(funcId);
|
||||
}
|
||||
}
|
||||
const gContexts = new Map;
|
||||
const gModules = new Map;
|
||||
@ -3610,6 +3621,25 @@ function animate(context) {
|
||||
}
|
||||
}
|
||||
|
||||
function notification(context) {
|
||||
return {
|
||||
publish: (args) => {
|
||||
if (args.data !== undefined) {
|
||||
args.data = JSON.stringify(args.data);
|
||||
}
|
||||
return context.notification.publish(args);
|
||||
},
|
||||
subscribe: (args) => {
|
||||
args.callback = context.function2Id(args.callback);
|
||||
return context.notification.subscribe(args);
|
||||
},
|
||||
unsubscribe: (subscribeId) => {
|
||||
context.removeFuncById(subscribeId);
|
||||
return context.notification.unsubscribe(subscribeId);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class Observable {
|
||||
constructor(provider, clz) {
|
||||
this.observers = new Set;
|
||||
@ -3753,6 +3783,7 @@ exports.modal = modal;
|
||||
exports.navbar = navbar;
|
||||
exports.navigator = navigator;
|
||||
exports.network = network;
|
||||
exports.notification = notification;
|
||||
exports.obj2Model = obj2Model;
|
||||
exports.popover = popover;
|
||||
exports.pullable = pullable;
|
||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user