diff --git a/src/abortAble.ts b/src/abortAble.ts index 54e4d96..5463616 100644 --- a/src/abortAble.ts +++ b/src/abortAble.ts @@ -2,21 +2,38 @@ export function isPromiseLike(p: PromiseLike | any): p is PromiseLike return p != null && p && typeof p.then === 'function'; } +/** + * a promise like object that has an abort method + */ export interface IAbortAblePromiseBase extends PromiseLike { then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): IAbortAblePromiseBase; + /** + * abort the promise when possible + */ abort(): void; + /** + * whether this promise was aborted + */ isAborted(): boolean; } +/** + * a promise like object that has an abort method and return the ABORTED symbol in case it was + */ export declare type IAbortAblePromise = IAbortAblePromiseBase; export declare type IAAP = IAbortAblePromise; - +/** + * an update result with an item and a promise when the update has been done + */ export interface IAsyncUpdate { item: T; ready: IAbortAblePromise; } +/** + * the symbol returned when the promise was aborted + */ export const ABORTED = Symbol('aborted'); function thenFactory(loader: PromiseLike, isAborted: () => boolean, abort: () => void) { @@ -78,6 +95,9 @@ export function abortAbleAll(values: [T1 | IAAP, T2 | IAAP, export function abortAbleAll(values: [T1 | IAAP, T2 | IAAP]): IAAP<[T1, T2]>; export function abortAbleAll(values: (T | IAAP)[]): IAAP; +/** + * similar to Promise.all but for abortAble + */ export function abortAbleAll(values: any[]): IAAP { const loader = Promise.all(values); let aborted: ((v: symbol) => void) | null = null; @@ -118,6 +138,9 @@ export function isAsyncUpdate(update: T | void | undefined | null | IAsyncUpd return update !== undefined && update !== null && update && isAbortAble((>update).ready); } +/** + * similar to Promise.resolve + */ export function abortAbleResolveNow(value: T) { function then(onfulfilled?: ((value: T | symbol) => TResult1 | PromiseLike) | undefined | null, _onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): IAbortAblePromiseBase { const res = onfulfilled ? onfulfilled(value) : value; diff --git a/src/style/GridStyleManager.ts b/src/style/GridStyleManager.ts index 223ef7d..a1b2bd5 100644 --- a/src/style/GridStyleManager.ts +++ b/src/style/GridStyleManager.ts @@ -183,8 +183,9 @@ export default class GridStyleManager extends StyleManager { } } /** + * measure the width and height of the scrollbars * based on Slick grid implementation - * @param doc + * @param root */ function measureScrollbar(root: HTMLElement) { const body = root.ownerDocument!.body;