Skip to content

Commit

Permalink
Update devices list more aggressively
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Dec 26, 2023
1 parent 734170b commit 461c29e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions webextensions/common/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,25 @@ export async function init() {
onConfigChanged(change.key, change.value);
}
preChanges = [];

browser.runtime.sendMessage(SEND_TABS_SIMULATOR_ID, { type: 'register-self' });
browser.runtime.onMessageExternal.addListener((message, sender) => {
if (!message ||
typeof message != 'object' ||
typeof message.type != 'string' ||
sender.id != SEND_TABS_SIMULATOR_ID)
return;

switch (message.type) {
case 'ready':
browser.runtime.sendMessage(SEND_TABS_SIMULATOR_ID, { type: 'register-self' });
case 'device-added':
case 'device-updated':
case 'device-removed':
updateSelf();
break;
}
});
}

export async function generateDeviceInfo({ name, icon } = {}) {
Expand Down

0 comments on commit 461c29e

Please sign in to comment.