[common] refactoring

This commit is contained in:
Maxim Kadushkin 2021-02-05 11:27:44 +03:00
parent 6e81f03df5
commit 77d955f5ad
2 changed files with 11 additions and 2 deletions

View file

@ -5,8 +5,15 @@ export default class Notifications {
}
on(event, callback) {
!this._events[event] && (this._events[event] = []);
this._events[event].push(callback);
const addevent = (e, c) => {
!this._events[e] && (this._events[e] = []);
this._events[e].push(c);
};
if ( typeof(event) == 'object' )
for (const i in event)
addevent(i, event[i])
else addevent(event, callback);
}
off(event, callback) {

View file

@ -134,6 +134,8 @@ class MainController extends Component {
const onDocumentContentReady = () => {
Common.Gateway.documentReady();
f7.emit('resize');
Common.Notifications.trigger('document:ready');
};
const _process_array = (array, fn) => {