({ module, action, value })
| 272 | if (!purchaseHandlerSet) { |
| 273 | purchaseHandlerSet = true; |
| 274 | const handler = async ({ module, action, value }) => { |
| 275 | if (module === "plugin" && action === "purchased" && value === id) { |
| 276 | loader.show(); |
| 277 | |
| 278 | try { |
| 279 | const pluginData = await fsOperation( |
| 280 | config.API_BASE, |
| 281 | `plugin/${id}`, |
| 282 | ).readFile("json"); |
| 283 | |
| 284 | purchased = pluginData.owned; |
| 285 | render(); |
| 286 | } catch (error) { |
| 287 | window.log(error); |
| 288 | helpers.error(error); |
| 289 | } |
| 290 | |
| 291 | loader.hide(); |
| 292 | purchaseHandlerSet = false; |
| 293 | removeIntentHandler(handler); |
| 294 | } |
| 295 | }; |
| 296 | addIntentHandler(handler); |
| 297 | cleanups.push(() => removeIntentHandler(handler)); |
| 298 | } |
no test coverage detected