是否可以在运行时更改事件映射?

时间:2018-08-03 13:54:15

标签: google-analytics ngrx redux-beacon

这是我们为redux-beacon定义事件映射的方式(根据the documentation)。

// Define an event
const pageView = (action: Action): PageView => ({
  hitType: 'pageview',
  page: action.payload.path,
});

// Map the event to an ngrx/store action
const eventsMap = {
  '[Router] Update Location': pageView,
};

// Create the meta Reducer
const analyticsMetaReducer = createMetaReducer(eventsMap, GoogleAnalytics);

我们创建一个meta reducer并传入商店

StoreModule.provideStore({
   // Wrap the router reducer in the meta reducer
   router: analyticsMetaReducer(routerReducer),
})

是否可以在运行时替换原始事件映射?

0 个答案:

没有答案