diff --git a/integrations/sync/client/client.ts b/integrations/sync/client/client.ts index f425754..04a81c1 100644 --- a/integrations/sync/client/client.ts +++ b/integrations/sync/client/client.ts @@ -29,9 +29,16 @@ emit( */ on("onClientResourceStart", (resource: string) => { if (resource !== GetCurrentResourceName()) return; + // @ts-expect-error index is not required + const currentResourceVersion = GetResourceMetadata(GetCurrentResourceName(), "version"); setTimeout(() => { - SendNuiMessage(JSON.stringify({ action: "sn:initialize", data: { url: API_URL } })); + SendNuiMessage( + JSON.stringify({ + action: "sn:initialize", + data: { version: currentResourceVersion, url: API_URL }, + }), + ); }, 500); }); diff --git a/integrations/sync/nui-dev/src/main.ts b/integrations/sync/nui-dev/src/main.ts index fe13b91..e6126f8 100644 --- a/integrations/sync/nui-dev/src/main.ts +++ b/integrations/sync/nui-dev/src/main.ts @@ -7,6 +7,7 @@ export interface NuiMessage { action: string; data?: { url: string; + version?: string; /** notification data */ message?: string; @@ -29,6 +30,9 @@ window.addEventListener("message", (event: MessageEvent) => { switch (event.data.action) { case "sn:initialize": { + if (event.data.data?.version) { + console.log(`[sna-sync-nui][incoming]: Version ${event.data.data.version}`); + } onSpawn(apiURL); break; }