지원 / Support
home
디스코드 / Discord
home

Electron

Electron Toolkit

Prerequisites

To integrate the SDK, you need an account that has been granted ownership of the game.
Ownership can be granted via a Game Key. After opening the store page, please request it from the STOVE Store Team.

Basic Integration

StovePCSDK_JS_2.6.6.zip
2818.9KB
// main.js const StovePCSDK = require("./StovePCSDK"); const config = { // Environment value; fixed to "Live". env: "Live", // Enter the product's Game ID. gameId: "", // Enter the product's Application Key. appKey: "", // Enter the product's Application Secret. secretKey: "", // Set to STOVE_PC_LOG_LEVEL_DEBUG for testing, STOVE_PC_LOG_LEVEL_ERROR for release. logLevel: StovePCSDK.StovePCLogLevel.STOVE_PC_LOG_LEVEL_DEBUG, // Path where logs are generated; keep as "" unless needed. logPath: "", }; const callback = { onError: (error) => { console.log(error); switch (error.functionType) { case StovePCSDK.StovePCFunctionType.STOVE_PC_INIT: case StovePCSDK.StovePCFunctionType.STOVE_PC_GET_USER: case StovePCSDK.StovePCFunctionType.STOVE_PC_GET_OWNERSHIP: app.quit(); break; } }, onInitComplete: () => { StovePCSDK.getUser(); }, onToken: (token) => {}, onUser: (user) => { StovePCSDK.getOwnership(); }, onOwnership: (ownerships) => { ownerships.forEach((ownership) => { if (ownership.gameId === config.gameId && ownership.ownershipCode !== 1) { app.quit(); } if ( ownership.gameId === config.gameId && ownership.gameCode === 5 && ownership.ownershipCode === 1 ) { // Activate DLC } }); }, onStat: (stat) => {}, onSetStat: (statValue) => {}, onAchievement: (achievement) => {}, onAllAchievement: (achievements) => {}, }; let handlerId = -1; app.whenReady().then(() => { const initResult = StovePCSDK.init(config, callback); if (initResult !== StovePCSDK.StovePCResult.STOVE_PC_NO_ERROR) { app.quit(); } handlerId = setInterval(() => { StovePCSDK.runCallback(); }, 1000); ipcMain.on("unlock-achievement", handleUnlockAchievement); }); app.on("window-all-closed", () => { clearInterval(handlerId); StovePCSDK.uninit(); app.quit(); }); function handleUnlockAchievement(statId) { StovePCSDK.unlockAchievement(statId); }
JavaScript
복사
// preload.js const { contextBridge, ipcRenderer } = require("electron"); contextBridge.exposeInMainWorld("electronAPI", { unlockAchievement: (statId) => ipcRenderer.send("unlock-achievement", statId), });
JavaScript
복사