@streetui/scheduler 3.1.0 → 3.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/package.json +1 -1
- package/dist/index.d.cts +0 -73
- package/dist/index.d.ts +0 -73
package/package.json
CHANGED
package/dist/index.d.cts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* StreetUI update scheduler.
|
|
3
|
-
*
|
|
4
|
-
* Responsibilities:
|
|
5
|
-
* - Queue update callbacks
|
|
6
|
-
* - Batch synchronous enqueues into a single microtask flush
|
|
7
|
-
* - Guarantee ordering: higher priority jobs flush first
|
|
8
|
-
* - Prevent duplicate work for the same job key
|
|
9
|
-
* - Allow synchronous flush for tests
|
|
10
|
-
*/
|
|
11
|
-
type Priority = 'immediate' | 'normal' | 'idle';
|
|
12
|
-
interface Job {
|
|
13
|
-
/** Unique key — if another job with the same key is already queued, it is replaced. */
|
|
14
|
-
readonly key: string;
|
|
15
|
-
readonly priority: Priority;
|
|
16
|
-
readonly fn: () => void;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Optional error-reporting hook (v0.9 §26/§27). Structurally compatible with
|
|
20
|
-
* `@streetui/core`'s `DiagnosticSink` (the `error` method) so an application can
|
|
21
|
-
* route swallowed scheduler-job failures through its own logger instead of the
|
|
22
|
-
* default `console.error`. Kept as a local structural type so the scheduler
|
|
23
|
-
* stays dependency-free; no network, no telemetry. When unset, behaviour is
|
|
24
|
-
* exactly as before.
|
|
25
|
-
*/
|
|
26
|
-
interface SchedulerDiagnostics {
|
|
27
|
-
error?(message: string, context?: unknown): void;
|
|
28
|
-
}
|
|
29
|
-
declare class Scheduler {
|
|
30
|
-
private readonly _queue;
|
|
31
|
-
private _flushScheduled;
|
|
32
|
-
private _flushing;
|
|
33
|
-
private _diagnostics;
|
|
34
|
-
/**
|
|
35
|
-
* Install an optional diagnostic sink for swallowed job errors. Pass
|
|
36
|
-
* `undefined` to restore the default `console.error` reporting. Additive and
|
|
37
|
-
* opt-in — the scheduler never sends anything anywhere on its own.
|
|
38
|
-
*/
|
|
39
|
-
setDiagnostics(sink: SchedulerDiagnostics | undefined): void;
|
|
40
|
-
/** Total jobs currently queued. */
|
|
41
|
-
get size(): number;
|
|
42
|
-
/** True if a flush has been scheduled but not yet executed. */
|
|
43
|
-
get isPending(): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Enqueue a job. If a job with the same key exists, the new one replaces it
|
|
46
|
-
* (allowing callers to coalesce repeated updates for the same node).
|
|
47
|
-
*/
|
|
48
|
-
schedule(job: Job): void;
|
|
49
|
-
/** Schedule multiple jobs atomically. */
|
|
50
|
-
scheduleAll(jobs: readonly Job[]): void;
|
|
51
|
-
/**
|
|
52
|
-
* Cancel a queued job by key. No-op if not queued.
|
|
53
|
-
*/
|
|
54
|
-
cancel(key: string): void;
|
|
55
|
-
/**
|
|
56
|
-
* Synchronously flush all queued jobs (sorted by priority).
|
|
57
|
-
* Useful in tests and for immediate rendering.
|
|
58
|
-
*/
|
|
59
|
-
flush(): void;
|
|
60
|
-
/** Clear all pending jobs without executing them. */
|
|
61
|
-
clear(): void;
|
|
62
|
-
private _scheduleMicrotask;
|
|
63
|
-
}
|
|
64
|
-
/** The shared global scheduler instance. */
|
|
65
|
-
declare const scheduler: Scheduler;
|
|
66
|
-
/** Convenience: schedule a normal-priority job. */
|
|
67
|
-
declare function scheduleUpdate(key: string, fn: () => void): void;
|
|
68
|
-
/** Convenience: schedule an immediate-priority job. */
|
|
69
|
-
declare function scheduleImmediate(key: string, fn: () => void): void;
|
|
70
|
-
/** Convenience: flush the global scheduler synchronously. */
|
|
71
|
-
declare function flushSync(): void;
|
|
72
|
-
|
|
73
|
-
export { type Job, type Priority, Scheduler, type SchedulerDiagnostics, flushSync, scheduleImmediate, scheduleUpdate, scheduler };
|
package/dist/index.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* StreetUI update scheduler.
|
|
3
|
-
*
|
|
4
|
-
* Responsibilities:
|
|
5
|
-
* - Queue update callbacks
|
|
6
|
-
* - Batch synchronous enqueues into a single microtask flush
|
|
7
|
-
* - Guarantee ordering: higher priority jobs flush first
|
|
8
|
-
* - Prevent duplicate work for the same job key
|
|
9
|
-
* - Allow synchronous flush for tests
|
|
10
|
-
*/
|
|
11
|
-
type Priority = 'immediate' | 'normal' | 'idle';
|
|
12
|
-
interface Job {
|
|
13
|
-
/** Unique key — if another job with the same key is already queued, it is replaced. */
|
|
14
|
-
readonly key: string;
|
|
15
|
-
readonly priority: Priority;
|
|
16
|
-
readonly fn: () => void;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Optional error-reporting hook (v0.9 §26/§27). Structurally compatible with
|
|
20
|
-
* `@streetui/core`'s `DiagnosticSink` (the `error` method) so an application can
|
|
21
|
-
* route swallowed scheduler-job failures through its own logger instead of the
|
|
22
|
-
* default `console.error`. Kept as a local structural type so the scheduler
|
|
23
|
-
* stays dependency-free; no network, no telemetry. When unset, behaviour is
|
|
24
|
-
* exactly as before.
|
|
25
|
-
*/
|
|
26
|
-
interface SchedulerDiagnostics {
|
|
27
|
-
error?(message: string, context?: unknown): void;
|
|
28
|
-
}
|
|
29
|
-
declare class Scheduler {
|
|
30
|
-
private readonly _queue;
|
|
31
|
-
private _flushScheduled;
|
|
32
|
-
private _flushing;
|
|
33
|
-
private _diagnostics;
|
|
34
|
-
/**
|
|
35
|
-
* Install an optional diagnostic sink for swallowed job errors. Pass
|
|
36
|
-
* `undefined` to restore the default `console.error` reporting. Additive and
|
|
37
|
-
* opt-in — the scheduler never sends anything anywhere on its own.
|
|
38
|
-
*/
|
|
39
|
-
setDiagnostics(sink: SchedulerDiagnostics | undefined): void;
|
|
40
|
-
/** Total jobs currently queued. */
|
|
41
|
-
get size(): number;
|
|
42
|
-
/** True if a flush has been scheduled but not yet executed. */
|
|
43
|
-
get isPending(): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Enqueue a job. If a job with the same key exists, the new one replaces it
|
|
46
|
-
* (allowing callers to coalesce repeated updates for the same node).
|
|
47
|
-
*/
|
|
48
|
-
schedule(job: Job): void;
|
|
49
|
-
/** Schedule multiple jobs atomically. */
|
|
50
|
-
scheduleAll(jobs: readonly Job[]): void;
|
|
51
|
-
/**
|
|
52
|
-
* Cancel a queued job by key. No-op if not queued.
|
|
53
|
-
*/
|
|
54
|
-
cancel(key: string): void;
|
|
55
|
-
/**
|
|
56
|
-
* Synchronously flush all queued jobs (sorted by priority).
|
|
57
|
-
* Useful in tests and for immediate rendering.
|
|
58
|
-
*/
|
|
59
|
-
flush(): void;
|
|
60
|
-
/** Clear all pending jobs without executing them. */
|
|
61
|
-
clear(): void;
|
|
62
|
-
private _scheduleMicrotask;
|
|
63
|
-
}
|
|
64
|
-
/** The shared global scheduler instance. */
|
|
65
|
-
declare const scheduler: Scheduler;
|
|
66
|
-
/** Convenience: schedule a normal-priority job. */
|
|
67
|
-
declare function scheduleUpdate(key: string, fn: () => void): void;
|
|
68
|
-
/** Convenience: schedule an immediate-priority job. */
|
|
69
|
-
declare function scheduleImmediate(key: string, fn: () => void): void;
|
|
70
|
-
/** Convenience: flush the global scheduler synchronously. */
|
|
71
|
-
declare function flushSync(): void;
|
|
72
|
-
|
|
73
|
-
export { type Job, type Priority, Scheduler, type SchedulerDiagnostics, flushSync, scheduleImmediate, scheduleUpdate, scheduler };
|