本文整理匯總了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);
}
}