🎯
Easy Integration
iframe-based embedding approach, integration in just a few lines of code
Simple and fast integration of TaskOn into your website
import { TaskOnEmbed } from "@taskon/embed";
// Initialize with language support
const embed = new TaskOnEmbed({
baseUrl: "https://yourtaskondomain.com",
containerElement: "#taskon-container",
language: "ko", // Start with Korean
width: "100%",
height: 600,
});
// Initialize the iframe
await embed.init();
// Handle login requirement
embed.on("loginRequired", async () => {
// Get signature from your server
const { signature, timestamp } = await getSignature();
await embed.login({
type: "Email",
account: "user@example.com",
signature,
timestamp,
});
});
// Handle task completion
embed.on("taskCompleted", data => {
console.log("Task completed:", data.taskName);
console.log("Rewards:", data.rewards);
});
// Switch language dynamically
await embed.setLanguage("ja"); // Switch to Japanese
// Handle route changes
embed.on("routeChanged", fullPath => {
console.log("Route changed:", fullPath);
});
// Logout and destroy
await embed.logout();
embed.destroy();