本文整理汇总了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));
});
示例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));
},