···184184 // windows are hidden/shown directly without pubsub round-trip.
185185 api.pubsub.subscribe('app:focus-changed', (msg) => {
186186 appFocused = !!msg.focused;
187187- }, api.scopes.GLOBAL);
187187+ });
188188189189 // Open HUD if it was enabled in a previous session
190190 if (hudEnabled) {
···1515 */
16161717import { getDb, tagItem, untagItem } from './datastore.js';
1818-import { publish, scopes as PubSubScopes } from './pubsub.js';
1818+import { publish } from './pubsub.js';
19192020/**
2121 * Tag an item and publish `tag:item-added` on the GLOBAL scope so UIs
···3434 const db = getDb();
3535 const tag = db.prepare('SELECT name FROM tags WHERE id = ?').get(tagId) as { name: string } | undefined;
3636 const item = db.prepare('SELECT type FROM items WHERE id = ?').get(itemId) as { type: string } | undefined;
3737- publish('system', PubSubScopes.GLOBAL, 'tag:item-added', {
3737+ publish('system', 'tag:item-added', {
3838 tagId,
3939 tagName: tag?.name,
4040 itemId,
···5454 const tag = db.prepare('SELECT name FROM tags WHERE id = ?').get(tagId) as { name: string } | undefined;
5555 const removed = untagItem(itemId, tagId);
5656 if (removed) {
5757- publish('system', PubSubScopes.GLOBAL, 'tag:item-removed', {
5757+ publish('system', 'tag:item-removed', {
5858 tagId,
5959 tagName: tag?.name,
6060 itemId,
···4949used in new code.
50505151```javascript
5252-api.pubsub.publish('example:image-added', payload, api.scopes.GLOBAL);
5252+api.pubsub.publish('example:image-added', payload);
53535454api.pubsub.subscribe('example:image-added', (msg) => {
5555 renderGallery();
5656-}, api.scopes.GLOBAL);
5656+});
5757```
58585959The manifest must declare every topic you publish or subscribe to under
+1-1
features/example/background.js
···87878888 // Notify that a new image was added
8989 if (hasPeekAPI) {
9090- api.pubsub.publish('example:image-added', { id: imageId, ...imageData }, api.scopes.GLOBAL);
9090+ api.pubsub.publish('example:image-added', { id: imageId, ...imageData });
9191 }
92929393 // Open the gallery to show the new image