Skip to content

Commit

Permalink
chore: log version
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Jun 13, 2024
1 parent 21591b7 commit 8c31108
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion integrations/sync/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
4 changes: 4 additions & 0 deletions integrations/sync/nui-dev/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface NuiMessage {
action: string;
data?: {
url: string;
version?: string;

/** notification data */
message?: string;
Expand All @@ -29,6 +30,9 @@ window.addEventListener("message", (event: MessageEvent<NuiMessage>) => {

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;
}
Expand Down

0 comments on commit 8c31108

Please sign in to comment.