本文整理汇总了TypeScript中lib/gaia/api/Gaia.api.goto方法的典型用法代码示例。如果您正苦于以下问题:TypeScript api.goto方法的具体用法?TypeScript api.goto怎么用?TypeScript api.goto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib/gaia/api/Gaia.api
的用法示例。
在下文中一共展示了api.goto方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onBeforeGoto
/**
* @method onBeforeGoto
* @param {GaiaEvent} event
*/
private onBeforeGoto(event:GaiaEvent):void
{
// example implementation to disallow access to pages by checking certain things
var dataManager = DataManager.getInstance();
var pageData:IPageData = Gaia.api.getPage(event.routeResult[0].branch).data || {};
var isAuthenticated = true;
// check if we are on a user page, but are not loggedin
// this could happen when going to a deeplink or using the browsers back button
if (pageData.hasOwnProperty('auth') && pageData.auth == true && isAuthenticated)
{
// not allowed, goto home
Gaia.api.goto('/index');
}
// redirect to 'next' page if already authenticated
else if (pageData.hasOwnProperty('ifAuthenticated') && isAuthenticated)
{
Gaia.api.goto(pageData.ifAuthenticated);
}
else
{
// allowed, just continue
this._beforeGotoHijack();
}
//todo: add 'current' class to the current active page (leaf)
}
示例2: gotoAchievementDetail
public gotoAchievementDetail(achievementId:any)
{
Gaia.api.goto(Branches.ACHIEVEMENTS_DETAIL, {slug: achievementId.id});
}