Socket
Socket
Sign inDemoInstall

@aurelia/platform

Package Overview
Dependencies
Maintainers
1
Versions
545
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aurelia/platform - npm Package Compare versions

Comparing version 2.0.1-dev.202407111120 to 2.0.1-dev.202408081231

13

CHANGELOG.md

@@ -6,2 +6,15 @@ # Change Log

<a name="2.0.0-beta.21"></a>
# 2.0.0-beta.21 (2024-08-08)
### Bug Fixes:
* **task-queue:** fix timing issue (#2007) ([6777dba](https://github.com/aurelia/aurelia/commit/6777dba))
### Refactorings:
* **task-queue:** remove 'reusable' param (#2008) ([54f43e8](https://github.com/aurelia/aurelia/commit/54f43e8))
* **task-queue:** remove 'reusable' param ([54f43e8](https://github.com/aurelia/aurelia/commit/54f43e8))
<a name="2.0.0-beta.20"></a>

@@ -8,0 +21,0 @@ # 2.0.0-beta.20 (2024-07-07)

12

dist/types/index.d.ts

@@ -38,3 +38,3 @@ declare const tsPending: "pending";

constructor(platform: Platform, $request: () => void, $cancel: () => void);
flush(time?: number): void;
flush(now?: number): void;
/**

@@ -80,3 +80,2 @@ * Cancel the next flush cycle (and/or the macrotask that schedules the next flush cycle, in case this is a microtask queue), if it was requested.

suspend: boolean;
readonly reusable: boolean;
callback: TaskCallback<T>;

@@ -86,7 +85,6 @@ readonly id: number;

get status(): TaskStatus;
constructor(tracer: Tracer, taskQueue: TaskQueue, createdTime: number, queueTime: number, preempt: boolean, persistent: boolean, suspend: boolean, reusable: boolean, callback: TaskCallback<T>);
constructor(tracer: Tracer, taskQueue: TaskQueue, createdTime: number, queueTime: number, preempt: boolean, persistent: boolean, suspend: boolean, callback: TaskCallback<T>);
run(time?: number): void;
cancel(): boolean;
reset(time: number): void;
reuse(time: number, delay: number, preempt: boolean, persistent: boolean, suspend: boolean, callback: TaskCallback<T>): void;
dispose(): void;

@@ -118,8 +116,2 @@ }

/**
* If `true`, the task will be kept in-memory after finishing, so that it can be reused for future tasks for efficiency.
*
* Defaults to `true`
*/
reusable?: boolean;
/**
* If `true`, and the task callback returns a promise, that promise will be awaited before consecutive tasks are run.

@@ -126,0 +118,0 @@ *

{
"name": "@aurelia/platform",
"version": "2.0.1-dev.202407111120",
"version": "2.0.1-dev.202408081231",
"main": "dist/cjs/index.cjs",

@@ -5,0 +5,0 @@ "module": "dist/esm/index.mjs",

@@ -129,8 +129,2 @@ const tsPending = 'pending' as const;

/** @internal */
private readonly _taskPool: Task[] = [];
/** @internal */
private _taskPoolSize: number = 0;
/** @internal */
private _lastRequest: number = 0;

@@ -182,10 +176,11 @@

public flush(time: number = this._now()): void {
public flush(now: number = this._now()): void {
if (__DEV__ && this._tracer.enabled) { this._tracer.enter(this, 'flush'); }
this._flushRequested = false;
this._lastFlush = time;
this._lastFlush = now;
// Only process normally if we are *not* currently waiting for an async task to finish
if (this._suspenderTask === void 0) {
let curr: Task;
if (this._pending.length > 0) {

@@ -196,5 +191,9 @@ this._processing.push(...this._pending);

if (this._delayed.length > 0) {
let i = -1;
while (++i < this._delayed.length && this._delayed[i].queueTime <= time) { /* do nothing */ }
this._processing.push(...this._delayed.splice(0, i));
for (let i = 0; i < this._delayed.length; ++i) {
curr = this._delayed[i];
if (curr.queueTime <= now) {
this._processing.push(curr);
this._delayed.splice(i--, 1);
}
}
}

@@ -225,5 +224,9 @@

if (this._delayed.length > 0) {
let i = -1;
while (++i < this._delayed.length && this._delayed[i].queueTime <= time) { /* do nothing */ }
this._processing.push(...this._delayed.splice(0, i));
for (let i = 0; i < this._delayed.length; ++i) {
curr = this._delayed[i];
if (curr.queueTime <= now) {
this._processing.push(curr);
this._delayed.splice(i--, 1);
}
}
}

@@ -298,3 +301,3 @@

const { delay, preempt, persistent, reusable, suspend } = { ...defaultQueueTaskOptions, ...opts };
const { delay, preempt, persistent, suspend } = { ...defaultQueueTaskOptions, ...opts };

@@ -316,19 +319,4 @@ if (preempt) {

let task: Task<T>;
if (reusable) {
const taskPool = this._taskPool;
const index = this._taskPoolSize - 1;
if (index >= 0) {
task = taskPool[index] as Task<T>;
taskPool[index] = (void 0)!;
this._taskPoolSize = index;
const task = new Task(this._tracer, this, time, time + delay, preempt, persistent, suspend, callback);
task.reuse(time, delay, preempt, persistent, suspend, callback);
} else {
task = new Task(this._tracer, this, time, time + delay, preempt, persistent, suspend, reusable, callback);
}
} else {
task = new Task(this._tracer, this, time, time + delay, preempt, persistent, suspend, reusable, callback);
}
if (preempt) {

@@ -378,14 +366,2 @@ this._processing[this._processing.length] = task;

/**
* Return a reusable task to the shared task pool.
* The next queued callback will reuse this task object instead of creating a new one, to save overhead of creating additional objects.
*
* @internal
*/
public _returnToPool(task: Task): void {
if (__DEV__ && this._tracer.enabled) { this._tracer.trace(this, 'returnToPool'); }
this._taskPool[this._taskPoolSize++] = task;
}
/**
* Reset the persistent task back to its pending state, preparing it for being invoked again on the next flush.

@@ -523,3 +499,2 @@ *

public suspend: boolean,
public readonly reusable: boolean,
public callback: TaskCallback<T>,

@@ -544,3 +519,2 @@ ) {

persistent,
reusable,
taskQueue,

@@ -580,6 +554,2 @@ callback,

}
if (!this.persistent && reusable) {
taskQueue._returnToPool(this);
}
})

@@ -620,6 +590,2 @@ .catch((err: TaskAbortError<T>) => {

}
if (!this.persistent && reusable) {
taskQueue._returnToPool(this);
}
}

@@ -646,3 +612,2 @@ } catch (err) {

const taskQueue = this.taskQueue;
const reusable = this.reusable;
const reject = this._reject;

@@ -660,6 +625,2 @@

if (reusable) {
taskQueue._returnToPool(this);
}
if (reject !== void 0) {

@@ -700,23 +661,2 @@ reject(new TaskAbortError(this));

public reuse(
time: number,
delay: number,
preempt: boolean,
persistent: boolean,
suspend: boolean,
callback: TaskCallback<T>,
): void {
if (__DEV__ && this._tracer.enabled) { this._tracer.enter(this, 'reuse'); }
this.createdTime = time;
this.queueTime = time + delay;
this.preempt = preempt;
this.persistent = persistent;
this.suspend = suspend;
this.callback = callback;
this._status = tsPending;
if (__DEV__ && this._tracer.enabled) { this._tracer.leave(this, 'reuse'); }
}
public dispose(): void {

@@ -756,8 +696,2 @@ if (__DEV__ && this._tracer.enabled) { this._tracer.trace(this, 'dispose'); }

/**
* If `true`, the task will be kept in-memory after finishing, so that it can be reused for future tasks for efficiency.
*
* Defaults to `true`
*/
reusable?: boolean;
/**
* If `true`, and the task callback returns a promise, that promise will be awaited before consecutive tasks are run.

@@ -800,3 +734,2 @@ *

const preempt = obj['preempt'];
const reusable = obj['reusable'];
const persistent = obj['persistent'];

@@ -806,3 +739,3 @@ const suspend = obj['suspend'];

const info = `id=${id} created=${created} queue=${queue} preempt=${preempt} persistent=${persistent} reusable=${reusable} status=${status} suspend=${suspend}`;
const info = `id=${id} created=${created} queue=${queue} preempt=${preempt} persistent=${persistent} status=${status} suspend=${suspend}`;
this.console.log(`${prefix}[T.${method}] ${info}`);

@@ -817,3 +750,2 @@ }

persistent: false,
reusable: true,
suspend: false,

@@ -820,0 +752,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc