@rocketman-streamkit/types 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/addon.d.ts +39 -5
- package/package.json +1 -1
- package/tsconfig.json +0 -0
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ API reference, manifest format, permissions, and addon categories are published
|
|
|
14
14
|
|
|
15
15
|
**[github.com/RocketMan-StreamKit/types](https://github.com/RocketMan-StreamKit/types)**
|
|
16
16
|
|
|
17
|
-
Open the branch that matches your target app version (for example `1.0.
|
|
17
|
+
Open the branch that matches your target app version (for example `1.0.7`) and start from [`index.md`](https://github.com/RocketMan-StreamKit/types/blob/1.0.7/index.md).
|
|
18
18
|
|
|
19
19
|
This npm package provides **TypeScript typings only**; the docs repo is the full written guide.
|
|
20
20
|
|
package/addon.d.ts
CHANGED
|
@@ -449,9 +449,28 @@ declare global {
|
|
|
449
449
|
/**
|
|
450
450
|
* In-addon event bus. Used mainly to handle HTTP endpoint callbacks registered via `network.endpoints.create`.
|
|
451
451
|
Handlers run in the integration worker when the main process forwards `customEvent` messages.
|
|
452
|
+
|
|
453
|
+
**Built-in events (main process → addon)**
|
|
454
|
+
|
|
455
|
+
| Event | When | Payload |
|
|
456
|
+
| --- | --- | --- |
|
|
457
|
+
| `overlayTriggerValue:{provider}:list\|create\|release` | Dynamic trigger value UI in settings | See `registerTriggers` dynamic contract |
|
|
458
|
+
| `triggers:applied-changed` | After settings save when trigger bindings for this addon changed | `{ previous, current }` grouped by system (`overlay`, `timer`, `game`, `gameInput`, `sounds`, `hotkeys`) |
|
|
459
|
+
| `gameInputTrigger` | Matching dashboard event for a game input rule | `{ actionId, trigger, record, user }` |
|
|
452
460
|
* @example events.On('onDonation', payload => {
|
|
453
461
|
console.log('Donation', payload.body);
|
|
454
462
|
return { ok: true };
|
|
463
|
+
});
|
|
464
|
+
* @example // React when saved trigger bindings change (e.g. clear internal caches)
|
|
465
|
+
events.On('triggers:applied-changed', ({ previous, current }) => {
|
|
466
|
+
const removed = (previous.overlay || []).filter(
|
|
467
|
+
item => !(current.overlay || []).some(
|
|
468
|
+
next => next.targetId === item.targetId && next.trigger.value === item.trigger.value
|
|
469
|
+
)
|
|
470
|
+
);
|
|
471
|
+
if (removed.length) {
|
|
472
|
+
console.log('Overlay rules removed', removed);
|
|
473
|
+
}
|
|
455
474
|
});
|
|
456
475
|
*/
|
|
457
476
|
var events: {
|
|
@@ -916,11 +935,20 @@ declare global {
|
|
|
916
935
|
|
|
917
936
|
**Dynamic provider contract**
|
|
918
937
|
|
|
919
|
-
- `overlayTriggerValue:{provider}:list` → `{ success, items
|
|
920
|
-
- `overlayTriggerValue:{provider}:create` → `{ success, valueId?, label?, meta? }`
|
|
938
|
+
- `overlayTriggerValue:{provider}:list` → `{ success, items?, message?, notify? }`
|
|
939
|
+
- `overlayTriggerValue:{provider}:create` → `{ success, valueId?, label?, meta?, message?, notify? }`
|
|
921
940
|
(payload includes `title`, `overlayId`, `context` from `requireValue`)
|
|
922
|
-
- `overlayTriggerValue:{provider}:release` → `{ success }` (payload: `valueId`;
|
|
941
|
+
- `overlayTriggerValue:{provider}:release` → `{ success, message?, notify? }` (payload: `valueId`;
|
|
923
942
|
called on settings save when the value is no longer referenced)
|
|
943
|
+
|
|
944
|
+
Optional `notify` shows a modal in settings (`variant`: `success` | `error` | `info`; `title?`, `message`).
|
|
945
|
+
|
|
946
|
+
**Trigger bindings after save**
|
|
947
|
+
|
|
948
|
+
When the user saves settings and bindings for this addon change, the main process fires
|
|
949
|
+
`triggers:applied-changed` with `{ previous, current }`. Each side groups rules by consumer
|
|
950
|
+
system: `overlay`, `timer`, `game` (as event source), `gameInput` (game addons as target),
|
|
951
|
+
`sounds`, `hotkeys`. Omitted groups mean no rules in that system.
|
|
924
952
|
* @example // Follow — no value field
|
|
925
953
|
await dashboard.registerTriggers([
|
|
926
954
|
{ type: 'follow', label: { en: 'New follower', ru: 'Новый фолловер' } },
|
|
@@ -983,9 +1011,15 @@ declare global {
|
|
|
983
1011
|
},
|
|
984
1012
|
},
|
|
985
1013
|
]);
|
|
986
|
-
events.On('overlayTriggerValue:rewards:
|
|
1014
|
+
events.On('overlayTriggerValue:rewards:create', async ({ title, context }) => ({
|
|
987
1015
|
success: true,
|
|
988
|
-
|
|
1016
|
+
valueId: 'abc',
|
|
1017
|
+
label: title,
|
|
1018
|
+
notify: {
|
|
1019
|
+
variant: 'success',
|
|
1020
|
+
title: { en: 'Reward created', ru: 'Награда создана' },
|
|
1021
|
+
message: { en: `Cost: ${context?.cost}`, ru: `Стоимость: ${context?.cost}` },
|
|
1022
|
+
},
|
|
989
1023
|
}));
|
|
990
1024
|
* @example // Pass matching trigger when pushing dashboard events
|
|
991
1025
|
await dashboard.addRecord(
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
File without changes
|