Skip to Content

Methods

TaskOnEmbed public API:

Properties

PropertyTypeDescription
initializedbooleanWhether iframe and bridge are initialized
currentRoutestringLatest route reported by iframe

Property Usage

if (!embed.initialized) { await embed.init(); } console.log("Current route:", embed.currentRoute);

Method Overview

MethodSignatureDescription
init() => Promise<void>Initialize iframe and communication bridge
login(params: LoginParams) => Promise<void>Login with email or wallet
logout(options?: LogoutOptions) => Promise<void>Logout current session
isAuthorized(authType, account) => Promise<boolean>Check whether account has valid auth cache
setRoute(fullPath: string) => Promise<void>Navigate iframe internal route
setLanguage(language: string) => Promise<void>Change iframe language at runtime
updateSize(width?, height?) => voidUpdate iframe width/height
destroy() => voidDispose iframe and event resources

init()

const embed = new TaskOnEmbed({ baseUrl: "https://your_embed_domain.com", containerElement: "#taskon-embed", }); await embed.init();

login()

await embed.login({ type: "Email", account: "[email protected]", signature, timestamp, });

For wallet:

await embed.login({ type: "WalletAddress", account: "0x1234...", provider: window.ethereum, });

logout()

await embed.logout(); await embed.logout({ clearAuth: true });

isAuthorized()

const ok = await embed.isAuthorized("Email", "[email protected]");

setRoute() and currentRoute

await embed.setRoute("/community/quests"); console.log(embed.currentRoute);

setLanguage()

await embed.setLanguage("ja");

updateSize()

embed.updateSize("100%", "820px"); embed.updateSize(960, 720);

destroy()

embed.destroy();

Use in route transitions and component unmount cleanup.

Last updated on