Skip to content

Commit

Permalink
Fix SDK Errors/Typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Cattn committed Sep 17, 2024
1 parent 6e24495 commit 8cd6300
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/lib/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import store from "store2"
import { toast } from "sonner"
import { atom } from "nanostores"
import type { Plugin } from "./types"
import { createSDK } from "./sdk"

store.set("savedPlugins", [], false)
store.set("disabledPlugins", [], false)
Expand All @@ -11,7 +12,7 @@ export const $plugins = atom<Plugin[]>([])
export function readyEvent() {
$plugins.get().forEach((plugin) => {
if (!plugin.onReady) return
plugin.onReady()
plugin.onReady(createSDK(plugin.id))
})
}

Expand Down Expand Up @@ -118,7 +119,7 @@ export function registerPlugin(plugin: Plugin): Plugin | undefined | void {
$plugins.set([...$plugins.get(), plugin])
console.log(plugin)

if (plugin.onReady) plugin.onReady()
if (plugin.onReady) plugin.onReady(createSDK(plugin.id))
return plugin
}

Expand Down
7 changes: 6 additions & 1 deletion src/lib/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
export default class SDK {
export class SDK {
// @ts-ignore
private id: string
constructor(id: string) {
this.id = id
}
}


export function createSDK(id: string) {
return new SDK(id)
}

0 comments on commit 8cd6300

Please sign in to comment.