Initial import: open-design source for helix-mind.ai distribution
Some checks failed
ci / Validate workspace (push) Successful in 12m32s
landing-page-ci / Validate landing page (push) Successful in 9m41s
landing-page-deploy / Deploy landing page (push) Failing after 5m23s
refresh-contributors-wall / Refresh contributors wall cache bust (push) Failing after 12s
github-metrics / Generate repository metrics SVG (push) Failing after 2m8s
Some checks failed
ci / Validate workspace (push) Successful in 12m32s
landing-page-ci / Validate landing page (push) Successful in 9m41s
landing-page-deploy / Deploy landing page (push) Failing after 5m23s
refresh-contributors-wall / Refresh contributors wall cache bust (push) Failing after 12s
github-metrics / Generate repository metrics SVG (push) Failing after 2m8s
This repository contains the open-design daemon CLI source code, built and packaged at https://helix-mind.ai/cli/open-design/latest.tgz for use by the HelixMind /design slash command. Licenses: Apache-2.0 (root) + MIT (skills/*)
This commit is contained in:
39
apps/web/public/od-notifications-sw.js
Normal file
39
apps/web/public/od-notifications-sw.js
Normal file
@@ -0,0 +1,39 @@
|
||||
// Browser service workers must be served as JavaScript files. This tiny
|
||||
// runtime exists only to display task-completion notifications and focus
|
||||
// the existing Open Design tab when the user clicks one.
|
||||
self.addEventListener('notificationclick', (event) => {
|
||||
event.notification.close();
|
||||
|
||||
const data = event.notification.data || {};
|
||||
const targetUrl = typeof data.url === 'string' ? data.url : self.location.origin;
|
||||
|
||||
event.waitUntil((async () => {
|
||||
const windows = await self.clients.matchAll({
|
||||
type: 'window',
|
||||
includeUncontrolled: true,
|
||||
});
|
||||
const sameOrigin = windows.find((client) => {
|
||||
try {
|
||||
return new URL(client.url).origin === self.location.origin;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (sameOrigin) {
|
||||
if ('navigate' in sameOrigin) {
|
||||
try {
|
||||
await sameOrigin.navigate(targetUrl);
|
||||
} catch {
|
||||
/* focus the existing tab below */
|
||||
}
|
||||
}
|
||||
return sameOrigin.focus();
|
||||
}
|
||||
|
||||
if (self.clients.openWindow) {
|
||||
return self.clients.openWindow(targetUrl);
|
||||
}
|
||||
return undefined;
|
||||
})());
|
||||
});
|
||||
Reference in New Issue
Block a user