@tixyel/streamelements 6.0.1 → 6.0.3
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 +9 -2
- package/dist/index.es.js +14 -7
- 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
|
@@ -1874,7 +1874,7 @@ interface CommandOptions {
|
|
|
1874
1874
|
run: (this: Client, args: string[], event: CommandEvent) => void;
|
|
1875
1875
|
test?: string;
|
|
1876
1876
|
aliases?: string[];
|
|
1877
|
-
permissions?: string[];
|
|
1877
|
+
permissions?: string[] | boolean;
|
|
1878
1878
|
admins?: string[];
|
|
1879
1879
|
}
|
|
1880
1880
|
type CommandEvent = {
|
|
@@ -1907,7 +1907,12 @@ declare class Command {
|
|
|
1907
1907
|
type QueueEvents<T> = {
|
|
1908
1908
|
load: [];
|
|
1909
1909
|
cancel: [];
|
|
1910
|
-
update: [
|
|
1910
|
+
update: [
|
|
1911
|
+
queue: QueueItem<T>[],
|
|
1912
|
+
priorityQueue: QueueItem<T>[],
|
|
1913
|
+
history: QueueItem<T>[],
|
|
1914
|
+
timeouts: Array<ReturnType<typeof setTimeout>>
|
|
1915
|
+
];
|
|
1911
1916
|
process: [item: QueueItem<T>, queue: useQueue<T>];
|
|
1912
1917
|
};
|
|
1913
1918
|
type QueueProps = {
|
|
@@ -1957,7 +1962,9 @@ declare class useQueue<T> extends EventProvider<QueueEvents<T>> {
|
|
|
1957
1962
|
duration: QueueDuration;
|
|
1958
1963
|
private loaded;
|
|
1959
1964
|
processor: QueueProcessor<T>;
|
|
1965
|
+
private readonly clientWaitRetryDelay;
|
|
1960
1966
|
constructor(options: QueueOptions<T>);
|
|
1967
|
+
private waitForClientAndBindLoad;
|
|
1961
1968
|
/**
|
|
1962
1969
|
* Enqueue an item or multiple items into the queue with optional processing options.
|
|
1963
1970
|
* @param value - The item or items to be enqueued. Can be a single value of type T or an array of objects containing the value and options.
|
package/dist/index.es.js
CHANGED
|
@@ -6090,7 +6090,7 @@ var y;
|
|
|
6090
6090
|
})(y || (y = {}));
|
|
6091
6091
|
class it {
|
|
6092
6092
|
constructor(e) {
|
|
6093
|
-
this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof G && (this.field = e.field ?? this.field, this.template = e.template ?? this.template, this.name = e.name ?? this.name, this.value = e.value ?? this.value, this.run = e.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
|
|
6093
|
+
this.field = "button", this.template = "button", this.name = "Button", this.value = "", window.client instanceof G && (this.field = e.field ?? this.field, this.template = e.template ?? (typeof this.field == "string" ? this.field : this.template), this.name = e.name ?? this.name, this.value = e.value ?? this.value, this.run = e.run, window.client.actions.buttons.push(this), window.client.emit("action", this, "created"));
|
|
6094
6094
|
}
|
|
6095
6095
|
generate(e) {
|
|
6096
6096
|
return y.utils.typedValues(e).reduce(
|
|
@@ -7171,12 +7171,17 @@ var q;
|
|
|
7171
7171
|
})(q || (q = {}));
|
|
7172
7172
|
class mt extends Z {
|
|
7173
7173
|
constructor(e) {
|
|
7174
|
-
if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, !
|
|
7175
|
-
throw new Error("useQueue can only be instantiated after the Client is initialized.");
|
|
7176
|
-
if (!e.processor || typeof e.processor != "function")
|
|
7174
|
+
if (super(), this.queue = [], this.priorityQueue = [], this.history = [], this.timeouts = [], this.running = !1, this.duration = void 0, this.loaded = !1, this.clientWaitRetryDelay = 50, !e.processor || typeof e.processor != "function")
|
|
7177
7175
|
throw new Error("A valid processor function must be provided to useQueue.");
|
|
7178
|
-
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0),
|
|
7179
|
-
|
|
7176
|
+
this.processor = e.processor, e.duration !== "client" && (this.duration = e.duration ?? 0), this.waitForClientAndBindLoad(e.duration);
|
|
7177
|
+
}
|
|
7178
|
+
waitForClientAndBindLoad(e = this.duration) {
|
|
7179
|
+
if (!(window?.client instanceof G)) {
|
|
7180
|
+
setTimeout(() => this.waitForClientAndBindLoad(e), this.clientWaitRetryDelay);
|
|
7181
|
+
return;
|
|
7182
|
+
}
|
|
7183
|
+
window.client.on("load", () => {
|
|
7184
|
+
e === "client" && (this.duration = window.client.fields?.widgetDuration ?? 0), this.emit("load"), this.loaded = !0;
|
|
7180
7185
|
});
|
|
7181
7186
|
}
|
|
7182
7187
|
enqueue(e, t = {}) {
|
|
@@ -7209,7 +7214,9 @@ class mt extends Z {
|
|
|
7209
7214
|
try {
|
|
7210
7215
|
await this.processor.apply(this, [e.value, this]), this.emit("process", e, this);
|
|
7211
7216
|
} catch (a) {
|
|
7212
|
-
R.error(
|
|
7217
|
+
R.error(
|
|
7218
|
+
`Error during item processing: ${a instanceof Error ? a.message : String(a)}`
|
|
7219
|
+
);
|
|
7213
7220
|
}
|
|
7214
7221
|
this.history.push(e);
|
|
7215
7222
|
const t = e.isPriority ? this.priorityQueue : this.queue;
|