diff --git a/examples/example-dockpanel-iife/index.html b/examples/example-dockpanel-iife/index.html index 70a56367b..629196ad6 100644 --- a/examples/example-dockpanel-iife/index.html +++ b/examples/example-dockpanel-iife/index.html @@ -14,6 +14,7 @@ + diff --git a/packages/coreutils/src/schedule.ts b/packages/coreutils/src/schedule.ts index 8385b0498..f8bc32f8a 100644 --- a/packages/coreutils/src/schedule.ts +++ b/packages/coreutils/src/schedule.ts @@ -1,21 +1,21 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. +/** + * Test whether the client is a brower and can request animation frames. + */ +const BROWSER = + typeof document !== 'undefined' && + typeof requestAnimationFrame === 'function'; + /** * A composite type for callback handles, useful for unscheduling the callback. */ -type Handle = +export type ScheduleHandle = | ReturnType | ReturnType | ReturnType; -/** - * Whether the client is a brower and can request animation frames. - */ -const BROWSER = - typeof document !== 'undefined' && - typeof requestAnimationFrame === 'function'; - /** * Schedules a function for invocation as soon as possible asynchronously. * @@ -23,7 +23,7 @@ const BROWSER = * * @returns A handle that can be used to `unschedule` the `fn` if possible. */ -export function schedule(fn: () => unknown): Handle { +export function schedule(fn: () => unknown): ScheduleHandle { if (BROWSER && document.visibilityState === 'hidden') { return setTimeout(fn); } @@ -38,7 +38,7 @@ export function schedule(fn: () => unknown): Handle { * * @param handle The handle for the callback to unschedule. */ -export function unschedule(handle: Handle): void { +export function unschedule(handle: ScheduleHandle): void { if (BROWSER && document.visibilityState === 'hidden') { return clearTimeout(handle as ReturnType); } diff --git a/review/api/coreutils.api.md b/review/api/coreutils.api.md index a3204772d..6d4414323 100644 --- a/review/api/coreutils.api.md +++ b/review/api/coreutils.api.md @@ -4,6 +4,8 @@ ```ts +/// + // @public export interface JSONArray extends Array { } @@ -106,12 +108,20 @@ export interface ReadonlyPartialJSONObject { // @public export type ReadonlyPartialJSONValue = JSONPrimitive | ReadonlyPartialJSONObject | ReadonlyPartialJSONArray; +// Warning: (ae-forgotten-export) The symbol "Handle" needs to be exported by the entry point index.d.ts +// +// @public +export function schedule(fn: () => unknown): Handle; + // @public export class Token { constructor(name: string); readonly name: string; } +// @public +export function unschedule(handle: Handle): void; + // @public export namespace UUID { const uuid4: () => string; diff --git a/review/api/polling.api.md b/review/api/polling.api.md index 13bfd6c6d..645dc7439 100644 --- a/review/api/polling.api.md +++ b/review/api/polling.api.md @@ -56,14 +56,14 @@ export class Poll implements IOb get disposed(): ISignal; get frequency(): IPoll.Frequency; set frequency(frequency: IPoll.Frequency); + get hidden(): boolean; get isDisposed(): boolean; readonly name: string; refresh(): Promise; schedule(next?: Partial & { cancel: (last: IPoll.State) => boolean; }>): Promise; - get standby(): Poll.Standby | (() => boolean | Poll.Standby); - set standby(standby: Poll.Standby | (() => boolean | Poll.Standby)); + standby: Poll.Standby | (() => boolean | Poll.Standby); start(): Promise; get state(): IPoll.State; stop(): Promise; @@ -78,6 +78,7 @@ export namespace Poll { auto?: boolean; factory: Factory; frequency?: Partial; + linger?: number; name?: string; standby?: Standby | (() => boolean | Standby); }