1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-10-15 13:24:25 +02:00

add ui events

This commit is contained in:
Kushagra Gour
2019-03-15 15:11:33 +05:30
parent 698de288e0
commit e39e284705
7 changed files with 26 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
import { trackEvent } from './analytics';
export const commandPaletteService = {
subscriptions: {},
subscribe(eventName, callback) {
@@ -11,6 +13,7 @@ export const commandPaletteService = {
};
},
publish(eventName, ...args) {
trackEvent('ui', 'commandPaletteCommandSelected', eventName);
const callbacks = this.subscriptions[eventName] || [];
callbacks.forEach(callback => {
callback(...args);