Skip to content

Commit d5d5a1a

Browse files
committed
GH-461 - Unpublish and trash
* Ability to toggle disable on sl button * Ability to spec a throttle for Queue class
1 parent 76a2144 commit d5d5a1a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

nx/public/sl/components.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class SlButton extends LitElement {
225225

226226
get _attrs() {
227227
return this.getAttributeNames().reduce((acc, name) => {
228-
if ((name === 'class' || name === 'label')) return acc;
228+
if ((name === 'class' || name === 'label' || name === 'disabled')) return acc;
229229
acc[name] = this.getAttribute(name);
230230
return acc;
231231
}, {});
@@ -236,6 +236,7 @@ class SlButton extends LitElement {
236236
<span class="sl-button">
237237
<button
238238
class="${this.class}"
239+
?disabled=${this.disabled}
239240
${spread(this._attrs)}>
240241
<slot></slot>
241242
</button>

nx/public/utils/tree.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { daFetch } from '../../utils/daFetch.js';
33
import { DA_ORIGIN } from './constants.js';
44

55
export class Queue {
6-
constructor(callback, maxConcurrent = 500, onError = null) {
6+
constructor(callback, maxConcurrent = 500, onError = null, throttle = null) {
77
this.queue = [];
88
this.activeCount = 0;
99
this.maxConcurrent = maxConcurrent;
10+
this.throttle = throttle;
1011
this.callback = callback;
1112

1213
this.push = this.push.bind(this);
@@ -38,6 +39,9 @@ export class Queue {
3839
throw e;
3940
}
4041
} finally {
42+
if (this.throttle) {
43+
await new Promise((resolve) => { setTimeout(() => { resolve(); }, this.throttle); });
44+
}
4145
this.activeCount -= 1;
4246
await this.processQueue();
4347
}

0 commit comments

Comments
 (0)