1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Desktop: Add support for searching and installing plugins from repository

This commit is contained in:
Laurent Cozic
2021-01-07 16:30:53 +00:00
parent 1700b29f7d
commit 6dc5a816e5
17 changed files with 775 additions and 329 deletions

View File

@@ -20,19 +20,18 @@ export enum IntervalType {
// Each queue should be associated with a specific entity (a note, resource, etc.)
export default class AsyncActionQueue {
queue_: QueueItem[] = [];
interval_: number;
intervalType_: number;
scheduleProcessingIID_: any = null;
processing_ = false;
needProcessing_ = false;
private queue_: QueueItem[] = [];
private interval_: number;
private intervalType_: number;
private scheduleProcessingIID_: any = null;
private processing_ = false;
constructor(interval: number = 100, intervalType: IntervalType = IntervalType.Debounce) {
public constructor(interval: number = 100, intervalType: IntervalType = IntervalType.Debounce) {
this.interval_ = interval;
this.intervalType_ = intervalType;
}
push(action: QueueItemAction, context: any = null) {
public push(action: QueueItemAction, context: any = null) {
this.queue_.push({
action: action,
context: context,
@@ -40,8 +39,8 @@ export default class AsyncActionQueue {
this.scheduleProcessing();
}
get queue(): QueueItem[] {
return this.queue_;
public get isEmpty(): boolean {
return !this.queue_.length;
}
private scheduleProcessing(interval: number = null) {
@@ -77,7 +76,7 @@ export default class AsyncActionQueue {
this.processing_ = false;
}
async reset() {
public async reset() {
if (this.scheduleProcessingIID_) {
shim.clearTimeout(this.scheduleProcessingIID_);
this.scheduleProcessingIID_ = null;
@@ -89,11 +88,11 @@ export default class AsyncActionQueue {
// Currently waitForAllDone() already finishes all the actions
// as quickly as possible so we can make it an alias.
async processAllNow() {
public async processAllNow() {
return this.waitForAllDone();
}
async waitForAllDone() {
public async waitForAllDone() {
if (!this.queue_.length) return Promise.resolve();
this.scheduleProcessing(1);