本文整理汇总了TypeScript中core/bootstrap.paramChangedHelper函数的典型用法代码示例。如果您正苦于以下问题:TypeScript paramChangedHelper函数的具体用法?TypeScript paramChangedHelper怎么用?TypeScript paramChangedHelper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了paramChangedHelper函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: new
bootstrapModule.run(($uiRouter: UIRouter) => {
'ngInject';
let visualizerEnabled = false;
let VisualizerPlugin: { new (): UIRouterPlugin } = null;
const loadVisualizer = () => {
// Auto-collapse certain states with lots of children
const collapseGlobs = ['home.*', 'home.*.application.*', 'home.*.application.insight.*'].map(
globStr => new Glob(globStr),
);
const collapsedStates = $uiRouter.stateRegistry
.get()
.filter(state => collapseGlobs.some(glob => glob.matches(state.name)));
collapsedStates.forEach(state => ((state.$$state() as any)._collapsed = true));
return System.import('@uirouter/visualizer')
.then((vis: any) => (VisualizerPlugin = vis.Visualizer))
.then(createVisualizer);
};
const createVisualizer = () => {
if (!visualizerEnabled) {
return;
}
// Cleanup any current visualizer first
destroyVisualizer();
if (VisualizerPlugin) {
$uiRouter.plugin(VisualizerPlugin);
} else {
loadVisualizer();
}
};
const destroyVisualizer = () => {
const plugin = $uiRouter.getPlugin('visualizer');
plugin && $uiRouter.dispose(plugin);
};
const toggleVisualizer = (enabled: boolean) => {
if (enabled === visualizerEnabled) {
return;
}
visualizerEnabled = enabled;
if (enabled) {
return createVisualizer();
} else {
return destroyVisualizer();
}
};
(window as any).vis = createVisualizer;
$uiRouter.transitionService.onBefore({}, paramChangedHelper('vis', toggleVisualizer));
});
开发者ID:mizzy,项目名称:deck,代码行数:57,代码来源:uiRouterVisualizer.toggle.ts
示例2: if
($uiRouter: UIRouter) => {
const changeTraceSetting = (newValue: string) => {
const trace = $uiRouter.trace;
trace.disable();
if (typeof newValue === 'string') {
if (newValue.toUpperCase() === 'TRUE') {
trace.enable(Category.TRANSITION);
} else if (newValue.toUpperCase() === 'ALL') {
trace.enable();
} else {
const traceValues = newValue.split(',').map(str => str.trim().toUpperCase());
trace.enable(...(traceValues as any));
}
}
};
$uiRouter.transitionService.onBefore({}, paramChangedHelper('trace', changeTraceSetting));
},
开发者ID:emjburns,项目名称:deck,代码行数:18,代码来源:transitionTrace.toggle.ts
注:本文中的core/bootstrap.paramChangedHelper函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论