本文整理汇总了TypeScript中crossroads.parse函数的典型用法代码示例。如果您正苦于以下问题:TypeScript parse函数的具体用法?TypeScript parse怎么用?TypeScript parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: changeHash
private changeHash(newHash, oldHash) {
let route = newHash;
//if (route) {
// history.replaceState({url: route}, "", location.protocol + '//' + location.host + '/' + route);
//}
//else {
// history.replaceState({url: '/' }, "", location.protocol + '//' + location.host);
//}
crossroads.parse(newHash);
}
示例2: parseHash
private parseHash(newHash, oldHash) {
//if (newHash == "")
//{
// if(location.pathname != "/" && location.pathname.length > 1)
// {
// newHash = location.pathname.slice(1);
// }
//}
crossroads.parse(newHash);
}
示例3:
this.eventDispatcherService.dispatch('inspectorExit').then((isBlockingNeeded) => {
if (!isBlockingNeeded) {
this.currentSectionId = RoutingService.getPathSection(newHash);
if (oldHash !== newHash) {
crossroads.ignoreState = true;
crossroads.parse(decodeURIComponent(newHash));
crossroads.ignoreState = false;
}
this.eventDispatcherService.dispatch('hashChange', newHash);
} else {
this.changeHash(oldHash);
this.eventDispatcherService.dispatch('hashChange', oldHash);
}
});
示例4: navigate
public navigate(path: string, force?: boolean) {
force = !!force;
if (hasher.appendHash.length === 0) {
hasher.appendHash = '?' + location.hash.split('?')[1] || this.middlewareClient.getExplicitHostParam();
} else {
hasher.appendHash = _.replace(hasher.appendHash, /^\?\?+/, '?');
}
if (force) {
let section = RoutingService.getPathSection(path);
if (path === '/' + section) {
this.currentStacks.delete(section);
} else {
crossroads.ignoreState = true;
crossroads.parse(path);
crossroads.ignoreState = false;
}
}
if (path[0] === '/') {
hasher.setHash(path);
} else {
hasher.setHash(hasher.getHash() + '/' + path);
}
}