@tixyel/streamelements 4.1.0 → 4.2.0
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/dist/index.d.ts +89 -58
- package/dist/index.es.js +1569 -1434
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -764,10 +764,12 @@ declare namespace TwitchEvents {
|
|
|
764
764
|
event: Event;
|
|
765
765
|
};
|
|
766
766
|
export type Event = common & (normal | gift | community | spam);
|
|
767
|
+
export type SubscriberTier = 'prime' | '1000' | '2000' | '3000';
|
|
767
768
|
type common = {
|
|
768
769
|
amount: number;
|
|
769
770
|
name: string;
|
|
770
771
|
displayName: string;
|
|
772
|
+
tier: SubscriberTier;
|
|
771
773
|
message?: string;
|
|
772
774
|
providerId?: string;
|
|
773
775
|
avatar?: string;
|
|
@@ -869,7 +871,7 @@ declare namespace TwitchEvents {
|
|
|
869
871
|
username: string;
|
|
870
872
|
displayName: string;
|
|
871
873
|
providerId: string;
|
|
872
|
-
tier:
|
|
874
|
+
tier: Subscriber.SubscriberTier;
|
|
873
875
|
quantity: 0;
|
|
874
876
|
avatar: string;
|
|
875
877
|
};
|
|
@@ -879,7 +881,7 @@ declare namespace TwitchEvents {
|
|
|
879
881
|
displayName: string;
|
|
880
882
|
providerId: string;
|
|
881
883
|
message: string;
|
|
882
|
-
tier:
|
|
884
|
+
tier: Subscriber.SubscriberTier;
|
|
883
885
|
streak: number;
|
|
884
886
|
quantity: number;
|
|
885
887
|
avatar: string;
|
|
@@ -890,7 +892,7 @@ declare namespace TwitchEvents {
|
|
|
890
892
|
displayName: string;
|
|
891
893
|
providerId: string;
|
|
892
894
|
message: string;
|
|
893
|
-
tier:
|
|
895
|
+
tier: Subscriber.SubscriberTier;
|
|
894
896
|
sender: string;
|
|
895
897
|
gifted: true;
|
|
896
898
|
quantity: 0;
|
|
@@ -902,7 +904,7 @@ declare namespace TwitchEvents {
|
|
|
902
904
|
displayName: string;
|
|
903
905
|
providerId: string;
|
|
904
906
|
message: string;
|
|
905
|
-
tier:
|
|
907
|
+
tier: Subscriber.SubscriberTier;
|
|
906
908
|
sender: string;
|
|
907
909
|
gifted: true;
|
|
908
910
|
quantity: 0;
|
|
@@ -1017,6 +1019,7 @@ declare namespace StreamElements {
|
|
|
1017
1019
|
}
|
|
1018
1020
|
namespace Twitch {
|
|
1019
1021
|
type Events = TwitchEvents.Raid.Data | TwitchEvents.Event.Data | TwitchEvents.Cheer.Data | TwitchEvents.Message.Data | TwitchEvents.Follower.Data | TwitchEvents.Subscriber.Data | TwitchEvents.DeleteMessage.Data | TwitchEvents.DeleteMessages.Data;
|
|
1022
|
+
type SubscriberTier = TwitchEvents.Subscriber.SubscriberTier;
|
|
1020
1023
|
type Raid = TwitchEvents.Raid.Data;
|
|
1021
1024
|
type Event = TwitchEvents.Event.Data;
|
|
1022
1025
|
type Cheer = TwitchEvents.Cheer.Data;
|
|
@@ -1237,27 +1240,27 @@ declare namespace StreamElements {
|
|
|
1237
1240
|
name: string;
|
|
1238
1241
|
amount: number;
|
|
1239
1242
|
};
|
|
1240
|
-
'cheer-
|
|
1243
|
+
'cheer-session-top-donator': {
|
|
1241
1244
|
name: string;
|
|
1242
1245
|
amount: number;
|
|
1243
1246
|
};
|
|
1244
|
-
'cheer-
|
|
1247
|
+
'cheer-weekly-top-donation': {
|
|
1245
1248
|
name: string;
|
|
1246
1249
|
amount: number;
|
|
1247
1250
|
};
|
|
1248
|
-
'cheer-
|
|
1251
|
+
'cheer-weekly-top-donator': {
|
|
1249
1252
|
name: string;
|
|
1250
1253
|
amount: number;
|
|
1251
1254
|
};
|
|
1252
|
-
'cheer-
|
|
1255
|
+
'cheer-monthly-top-donation': {
|
|
1253
1256
|
name: string;
|
|
1254
1257
|
amount: number;
|
|
1255
1258
|
};
|
|
1256
|
-
'cheer-
|
|
1259
|
+
'cheer-monthly-top-donator': {
|
|
1257
1260
|
name: string;
|
|
1258
1261
|
amount: number;
|
|
1259
1262
|
};
|
|
1260
|
-
'cheer-
|
|
1263
|
+
'cheer-alltime-top-donation': {
|
|
1261
1264
|
name: string;
|
|
1262
1265
|
amount: number;
|
|
1263
1266
|
};
|
|
@@ -1603,6 +1606,70 @@ declare namespace Alejo {
|
|
|
1603
1606
|
function get(username: string): Promise<Pronouns.name | undefined>;
|
|
1604
1607
|
}
|
|
1605
1608
|
|
|
1609
|
+
type QueueEvents<T> = {
|
|
1610
|
+
load: [];
|
|
1611
|
+
cancel: [];
|
|
1612
|
+
update: [queue: QueueItem<T>[], priorityQueue: QueueItem<T>[], history: QueueItem<T>[], timeouts: Array<ReturnType<typeof setTimeout>>];
|
|
1613
|
+
process: [item: QueueItem<T>, queue: useQueue<T>];
|
|
1614
|
+
};
|
|
1615
|
+
type QueueProps = {
|
|
1616
|
+
isoDate: string;
|
|
1617
|
+
isLoop: boolean;
|
|
1618
|
+
isPriority: boolean;
|
|
1619
|
+
isImmediate: boolean;
|
|
1620
|
+
};
|
|
1621
|
+
type QueueItem<T> = {
|
|
1622
|
+
value: T;
|
|
1623
|
+
} & QueueProps;
|
|
1624
|
+
type QueueProcessor<T> = (item: T, queue: useQueue<T>) => Promise<any>;
|
|
1625
|
+
type QueueDuration = number | boolean | undefined;
|
|
1626
|
+
interface QueueOptions<T> {
|
|
1627
|
+
/**
|
|
1628
|
+
* Duration between processing each item in milliseconds. Set to `0` or `false` for immediate processing.
|
|
1629
|
+
*/
|
|
1630
|
+
duration: QueueDuration | 'client';
|
|
1631
|
+
/**
|
|
1632
|
+
* Function to process each item in the queue.
|
|
1633
|
+
*/
|
|
1634
|
+
processor: QueueProcessor<T>;
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* A utility class to manage a queue of items with support for priority, looping, and immediate processing.
|
|
1638
|
+
* @template T - The type of items in the queue.
|
|
1639
|
+
* @extends EventProvider<QueueEvents<T>>
|
|
1640
|
+
* @example
|
|
1641
|
+
* ```javascript
|
|
1642
|
+
* const myQueue = new useQueue({
|
|
1643
|
+
* duration: 1000,
|
|
1644
|
+
* processor: async (item) => {
|
|
1645
|
+
* console.log('Processing item:', item);
|
|
1646
|
+
* },
|
|
1647
|
+
* });
|
|
1648
|
+
*
|
|
1649
|
+
* myQueue.enqueue('Item 1');
|
|
1650
|
+
* myQueue.enqueue('Item 2', { isPriority: true });
|
|
1651
|
+
* ```
|
|
1652
|
+
*/
|
|
1653
|
+
declare class useQueue<T> extends EventProvider<QueueEvents<T>> {
|
|
1654
|
+
queue: QueueItem<T>[];
|
|
1655
|
+
priorityQueue: QueueItem<T>[];
|
|
1656
|
+
history: QueueItem<T>[];
|
|
1657
|
+
private timeouts;
|
|
1658
|
+
running: boolean;
|
|
1659
|
+
duration: QueueDuration;
|
|
1660
|
+
private loaded;
|
|
1661
|
+
processor: QueueProcessor<T>;
|
|
1662
|
+
constructor(options: QueueOptions<T>);
|
|
1663
|
+
enqueue(value: T, options?: Partial<QueueProps>): this;
|
|
1664
|
+
private run;
|
|
1665
|
+
private next;
|
|
1666
|
+
resume(): this;
|
|
1667
|
+
update(save: Partial<useQueue<T>>): this;
|
|
1668
|
+
cancel(): void;
|
|
1669
|
+
hasItems(): boolean;
|
|
1670
|
+
on<K extends keyof QueueEvents<T>>(eventName: K, callback: (this: useQueue<T>, ...args: QueueEvents<T>[K]) => void): this;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1606
1673
|
declare namespace Simulation {
|
|
1607
1674
|
export const data: {
|
|
1608
1675
|
names: string[];
|
|
@@ -1934,7 +2001,7 @@ declare namespace Simulation {
|
|
|
1934
2001
|
* @param session - The session data to be included in the event.
|
|
1935
2002
|
* @returns A Promise that resolves to the simulated onSessionUpdate event data.
|
|
1936
2003
|
*/
|
|
1937
|
-
onSessionUpdate(session?: StreamElements.Session.Data): Promise<StreamElements.Event.onSessionUpdate>;
|
|
2004
|
+
onSessionUpdate(session?: StreamElements.Session.Data, update?: ClientEvents$1): Promise<StreamElements.Event.onSessionUpdate>;
|
|
1938
2005
|
/**
|
|
1939
2006
|
* Simulates the onEventReceived event for a widget.
|
|
1940
2007
|
* @param provider - The provider of the event (default is 'random').
|
|
@@ -1953,6 +2020,17 @@ declare namespace Simulation {
|
|
|
1953
2020
|
onEventReceived(provider?: Provider$1 | "random", type?: StreamElements.Event.onEventReceived["listener"] | "random" | "tip" | "cheer" | "follower" | "raid" | "subscriber", options?: Record<string, string | number | boolean>): Promise<StreamElements.Event.onEventReceived | null>;
|
|
1954
2021
|
};
|
|
1955
2022
|
};
|
|
2023
|
+
export const Queue: useQueue<{
|
|
2024
|
+
listener: "onEventReceived";
|
|
2025
|
+
data: StreamElements.Event.onEventReceived;
|
|
2026
|
+
session?: boolean;
|
|
2027
|
+
} | {
|
|
2028
|
+
listener: "onWidgetLoad";
|
|
2029
|
+
data: StreamElements.Event.onWidgetLoad;
|
|
2030
|
+
} | {
|
|
2031
|
+
listener: "onSessionUpdate";
|
|
2032
|
+
data: StreamElements.Event.onSessionUpdate;
|
|
2033
|
+
}>;
|
|
1956
2034
|
export const emulate: {
|
|
1957
2035
|
twitch: {
|
|
1958
2036
|
message(data?: Partial<{
|
|
@@ -2269,53 +2347,6 @@ declare class Command {
|
|
|
2269
2347
|
static execute(received: CommandEvent): boolean;
|
|
2270
2348
|
}
|
|
2271
2349
|
|
|
2272
|
-
type QueueEvents<T> = {
|
|
2273
|
-
load: [];
|
|
2274
|
-
cancel: [];
|
|
2275
|
-
update: [queue: QueueItem<T>[], priorityQueue: QueueItem<T>[], history: QueueItem<T>[], timeouts: Array<ReturnType<typeof setTimeout>>];
|
|
2276
|
-
process: [item: QueueItem<T>, queue: useQueue<T>];
|
|
2277
|
-
};
|
|
2278
|
-
type QueueProps = {
|
|
2279
|
-
isoDate: string;
|
|
2280
|
-
isLoop: boolean;
|
|
2281
|
-
isPriority: boolean;
|
|
2282
|
-
isImmediate: boolean;
|
|
2283
|
-
};
|
|
2284
|
-
type QueueItem<T> = {
|
|
2285
|
-
value: T;
|
|
2286
|
-
} & QueueProps;
|
|
2287
|
-
type QueueProcessor<T> = (item: T, queue: useQueue<T>) => Promise<any>;
|
|
2288
|
-
type QueueDuration = number | boolean | undefined;
|
|
2289
|
-
interface QueueOptions<T> {
|
|
2290
|
-
/**
|
|
2291
|
-
* Duration between processing each item in milliseconds. Set to `0` or `false` for immediate processing.
|
|
2292
|
-
*/
|
|
2293
|
-
duration: QueueDuration;
|
|
2294
|
-
/**
|
|
2295
|
-
* Function to process each item in the queue.
|
|
2296
|
-
*/
|
|
2297
|
-
processor: QueueProcessor<T>;
|
|
2298
|
-
}
|
|
2299
|
-
declare class useQueue<T> extends EventProvider<QueueEvents<T>> {
|
|
2300
|
-
queue: QueueItem<T>[];
|
|
2301
|
-
priorityQueue: QueueItem<T>[];
|
|
2302
|
-
history: QueueItem<T>[];
|
|
2303
|
-
private timeouts;
|
|
2304
|
-
running: boolean;
|
|
2305
|
-
duration: QueueDuration;
|
|
2306
|
-
private loaded;
|
|
2307
|
-
processor: QueueProcessor<T>;
|
|
2308
|
-
constructor(options: QueueOptions<T>);
|
|
2309
|
-
enqueue(value: T, options?: Partial<QueueProps>): this;
|
|
2310
|
-
private run;
|
|
2311
|
-
private next;
|
|
2312
|
-
resume(): this;
|
|
2313
|
-
update(save: Partial<useQueue<T>>): this;
|
|
2314
|
-
cancel(): void;
|
|
2315
|
-
hasItems(): boolean;
|
|
2316
|
-
on<K extends keyof QueueEvents<T>>(eventName: K, callback: (this: useQueue<T>, ...args: QueueEvents<T>[K]) => void): this;
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
2350
|
interface Theme {
|
|
2320
2351
|
color?: string;
|
|
2321
2352
|
background?: string;
|