本文整理汇总了TypeScript中app/store/store.store类的典型用法代码示例。如果您正苦于以下问题:TypeScript store类的具体用法?TypeScript store怎么用?TypeScript store使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了store类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: updateLocation
this.$rootScope.$on('$routeUpdate', (evt, data) => {
const angularUrl = this.$location.url();
const state = store.getState();
if (state.location.url !== angularUrl) {
store.dispatch(
updateLocation({
path: this.$location.path(),
query: this.$location.search(),
routeParams: this.$route.current.params,
})
);
}
});
开发者ID:grafana,项目名称:grafana,代码行数:13,代码来源:bridge_srv.ts
示例2: init
init() {
this.$rootScope.$on('$routeUpdate', (evt, data) => {
const angularUrl = this.$location.url();
const state = store.getState();
if (state.location.url !== angularUrl) {
store.dispatch(
updateLocation({
path: this.$location.path(),
query: this.$location.search(),
routeParams: this.$route.current.params,
})
);
}
});
this.$rootScope.$on('$routeChangeSuccess', (evt, data) => {
store.dispatch(
updateLocation({
path: this.$location.path(),
query: this.$location.search(),
routeParams: this.$route.current.params,
})
);
});
// Listen for changes in redux location -> update angular location
store.subscribe(() => {
const state = store.getState();
const angularUrl = this.$location.url();
const url = locationUtil.stripBaseFromUrl(state.location.url);
if (angularUrl !== url) {
this.$timeout(() => {
this.$location.url(url);
// some state changes should not trigger new browser history
if (state.location.replace) {
this.$location.replace();
}
});
console.log('store updating angular $location.url', url);
}
});
appEvents.on('location-change', (payload: any) => {
const urlWithoutBase = locationUtil.stripBaseFromUrl(payload.href);
if (this.fullPageReloadRoutes.indexOf(urlWithoutBase) > -1) {
this.$window.location.href = payload.href;
return;
}
this.$timeout(() => {
// A hack to use timeout when we're changing things (in this case the url) from outside of Angular.
this.$location.url(urlWithoutBase);
});
});
}
开发者ID:grafana,项目名称:grafana,代码行数:55,代码来源:bridge_srv.ts
示例3: updateLocation
const onViewPanel = () => {
store.dispatch(
updateLocation({
query: {
panelId: panel.id,
edit: null,
fullscreen: true,
},
partial: true,
})
);
};
开发者ID:grafana,项目名称:grafana,代码行数:12,代码来源:getPanelMenu.ts
示例4:
store.subscribe(() => {
const state = store.getState();
const angularUrl = this.$location.url();
const url = locationUtil.stripBaseFromUrl(state.location.url);
if (angularUrl !== url) {
this.$timeout(() => {
this.$location.url(url);
// some state changes should not trigger new browser history
if (state.location.replace) {
this.$location.replace();
}
});
console.log('store updating angular $location.url', url);
}
});
开发者ID:grafana,项目名称:grafana,代码行数:15,代码来源:bridge_srv.ts
注:本文中的app/store/store.store类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论