progress-events
Advanced tools
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["/**\n * Progress events are emitted during long running operations\n */\nexport interface ProgressEvent<T extends string = any, D = unknown> {\n /**\n * The event type\n */\n type: T\n\n /**\n * Context-specific event information\n */\n detail: D\n}\n\n/**\n * An implementation of the ProgressEvent interface, this is essentially\n * a typed `CustomEvent` with a `type` property that lets us disambiguate\n * events passed to `progress` callbacks.\n */\nexport class CustomProgressEvent<D = unknown, T extends string = any> extends Event implements ProgressEvent<T, D> {\n public type: T\n public detail: D\n\n constructor (type: T, detail?: D) {\n super(type)\n\n this.type = type\n // @ts-expect-error detail may be undefined\n this.detail = detail\n }\n}\n\n/**\n * Define an `onProgress` callback that can be invoked with `ProgressEvent`s\n *\n * @example\n *\n * ```typescript\n * type MyOperationProgressEvents =\n * ProgressEvent<'operation:start'> |\n * ProgressEvent<'operation:success', Result> |\n * ProgressEvent<'operation:error', Error>\n *\n * export interface MyOperationOptions extends ProgressOptions<MyOperationProgressEvents> {\n * // define options here\n * }\n * ```\n */\nexport interface ProgressOptions<Event extends ProgressEvent = any> {\n onProgress?(evt: Event): void\n}\n"], | ||
| "mappings": ";kcAeA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAKM,IAAOA,EAAP,cAAwE,KAAK,CAC1E,KACA,OAEP,YAAaC,EAASC,EAAU,CAC9B,MAAMD,CAAI,EAEV,KAAK,KAAOA,EAEZ,KAAK,OAASC,CAChB", | ||
| "sourcesContent": ["/**\n * Progress events are emitted during long running operations\n */\nexport interface ProgressEvent<T extends string = any, D = unknown> {\n /**\n * The event type\n */\n type: T\n\n /**\n * Context-specific event information\n */\n detail: D\n}\n\n/**\n * A callback function that receives progress events\n */\nexport interface ProgressEventListener<E extends ProgressEvent = any> {\n (evt: E): void\n}\n\n/**\n * An implementation of the ProgressEvent interface, this is essentially\n * a typed `CustomEvent` with a `type` property that lets us disambiguate\n * events passed to `progress` callbacks.\n */\nexport class CustomProgressEvent<D = unknown, T extends string = any> extends Event implements ProgressEvent<T, D> {\n public type: T\n public detail: D\n\n constructor (type: T, detail?: D) {\n super(type)\n\n this.type = type\n // @ts-expect-error detail may be undefined\n this.detail = detail\n }\n}\n\n/**\n * Define an `onProgress` callback that can be invoked with `ProgressEvent`s\n *\n * @example\n *\n * ```typescript\n * type MyOperationProgressEvents =\n * ProgressEvent<'operation:start'> |\n * ProgressEvent<'operation:success', Result> |\n * ProgressEvent<'operation:error', Error>\n *\n * export interface MyOperationOptions extends ProgressOptions<MyOperationProgressEvents> {\n * // define options here\n * }\n * ```\n */\nexport interface ProgressOptions<Event extends ProgressEvent = any> {\n onProgress?: ProgressEventListener<Event>\n}\n"], | ||
| "mappings": ";kcAsBA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAKM,IAAOA,EAAP,cAAwE,KAAK,CAC1E,KACA,OAEP,YAAaC,EAASC,EAAU,CAC9B,MAAMD,CAAI,EAEV,KAAK,KAAOA,EAEZ,KAAK,OAASC,CAChB", | ||
| "names": ["index_exports", "__export", "CustomProgressEvent", "type", "detail"] | ||
| } |
@@ -15,2 +15,8 @@ /** | ||
| /** | ||
| * A callback function that receives progress events | ||
| */ | ||
| export interface ProgressEventListener<E extends ProgressEvent = any> { | ||
| (evt: E): void; | ||
| } | ||
| /** | ||
| * An implementation of the ProgressEvent interface, this is essentially | ||
@@ -42,4 +48,4 @@ * a typed `CustomEvent` with a `type` property that lets us disambiguate | ||
| export interface ProgressOptions<Event extends ProgressEvent = any> { | ||
| onProgress?(evt: Event): void; | ||
| onProgress?: ProgressEventListener<Event>; | ||
| } | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,EAAE,CAAC,GAAG,OAAO;IAChE;;O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,SAAS,aAAa,GAAG,GAAG;IAChE,UAAU,CAAC,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAA;CAC1C"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,MAAM,OAAO,mBAAyD,SAAQ,KAAK;IAC1E,IAAI,CAAG;IACP,MAAM,CAAG;IAEhB,YAAa,IAAO,EAAE,MAAU;QAC9B,KAAK,CAAC,IAAI,CAAC,CAAA;QAEX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,2CAA2C;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,MAAM,OAAO,mBAAyD,SAAQ,KAAK;IAC1E,IAAI,CAAG;IACP,MAAM,CAAG;IAEhB,YAAa,IAAO,EAAE,MAAU;QAC9B,KAAK,CAAC,IAAI,CAAC,CAAA;QAEX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,2CAA2C;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF"} |
@@ -6,4 +6,6 @@ { | ||
| ".:ProgressEvent": "https://achingbrain.github.io/progress-events/interfaces/ProgressEvent.html", | ||
| "ProgressEventListener": "https://achingbrain.github.io/progress-events/interfaces/ProgressEventListener.html", | ||
| ".:ProgressEventListener": "https://achingbrain.github.io/progress-events/interfaces/ProgressEventListener.html", | ||
| "ProgressOptions": "https://achingbrain.github.io/progress-events/interfaces/ProgressOptions.html", | ||
| ".:ProgressOptions": "https://achingbrain.github.io/progress-events/interfaces/ProgressOptions.html" | ||
| } |
+1
-1
| { | ||
| "name": "progress-events", | ||
| "version": "1.0.2", | ||
| "version": "1.1.0", | ||
| "description": "Progress events and types", | ||
@@ -5,0 +5,0 @@ "author": "", |
+8
-1
@@ -17,2 +17,9 @@ /** | ||
| /** | ||
| * A callback function that receives progress events | ||
| */ | ||
| export interface ProgressEventListener<E extends ProgressEvent = any> { | ||
| (evt: E): void | ||
| } | ||
| /** | ||
| * An implementation of the ProgressEvent interface, this is essentially | ||
@@ -52,3 +59,3 @@ * a typed `CustomEvent` with a `type` property that lets us disambiguate | ||
| export interface ProgressOptions<Event extends ProgressEvent = any> { | ||
| onProgress?(evt: Event): void | ||
| onProgress?: ProgressEventListener<Event> | ||
| } |
12984
6.93%131
11.97%