Files
DefinitelyTyped/types/humane-js/index.d.ts
T
Christophe Coevoet 0f0d84477c [humane-js] Fix humane-js types (#40043)
* Rename the humane types to humane-js to match the package name

* Improve humane-js types

- define the exported CommonJS API instead of documenting the global
  variable from the UMD pattern
- fix the list of available options
- use proper signatures for various functions instead of generic
  Function types
- use optional parameters instead of function overload without extra
  params for proper types

* Enable the strict linting rules for the humane-js types
2019-11-05 13:25:01 -08:00

47 lines
1.3 KiB
TypeScript

// Type definitions for Humane 3.2
// Project: http://wavded.github.com/humane-js/
// Definitions by: jmvrbanac <https://github.com/jmvrbanac>, stof <https://github.com/stof>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface HumaneMessageOptions {
addnCls?: string;
timeout?: number;
waitForMove?: boolean;
clickToClose?: boolean;
}
interface HumaneOptions extends HumaneMessageOptions {
baseCls?: string;
container?: Element;
}
type completionCallback = () => void;
type logMessage = string | ReadonlyArray<string>;
interface SpawnLogFunction {
(message: logMessage, options?: HumaneMessageOptions): Humane;
(message: logMessage, callback?: completionCallback, options?: HumaneMessageOptions): Humane;
}
interface Humane {
queue: string[];
baseCls: string;
container: Element;
addnCls: string;
timeout: number;
waitForMove: boolean;
clickToClose: boolean;
create(options?: HumaneOptions): Humane;
info?: SpawnLogFunction;
error?: SpawnLogFunction;
spawn(options: HumaneMessageOptions): SpawnLogFunction;
remove(cb?: completionCallback): void;
log(message: logMessage, options?: HumaneMessageOptions): Humane;
log(message: logMessage, callback?: completionCallback, options?: HumaneMessageOptions): Humane;
}
declare var humane: Humane;
export = humane;