diff --git a/packages/@uppy/aws-s3/src/index.js b/packages/@uppy/aws-s3/src/index.js index 1b0f17fd0..dca5c1df7 100644 --- a/packages/@uppy/aws-s3/src/index.js +++ b/packages/@uppy/aws-s3/src/index.js @@ -15,8 +15,8 @@ * will expire before some files can be uploaded. * * The long-term solution to this problem is to change the upload pipeline so that files - * can be sent to the next step individually. That requires a breakig change, so it is - * planned for Uppy v2. + * can be sent to the next step individually. That requires a breaking change, so it is + * planned for some future Uppy version. * * In the mean time, this plugin is stuck with a hackier approach: the necessary parts * of the XHRUpload implementation were copied into this plugin, as the MiniXHRUpload diff --git a/packages/@uppy/core/types/index.d.ts b/packages/@uppy/core/types/index.d.ts index 539407164..3770cf76c 100644 --- a/packages/@uppy/core/types/index.d.ts +++ b/packages/@uppy/core/types/index.d.ts @@ -147,17 +147,17 @@ declare module Uppy { type UploadHandler = (fileIDs: string[]) => Promise + type UploadSuccessCallback = (file: UppyFile, body: any, uploadURL: string) => void + type UploadCompleteCallback = (result: UploadResult) => void + class Uppy { constructor(opts?: UppyOptions) - on = {}>( - event: 'upload-success', - callback: (file: UppyFile, body: any, uploadURL: string) => void - ): this - on = {}>( - event: 'complete', - callback: (result: UploadResult) => void - ): this + on = {}>(event: 'upload-success', callback: UploadSuccessCallback): this + on = {}>(event: 'complete', callback: UploadCompleteCallback): this on(event: Event, callback: (...args: any[]) => void): this + once = {}>(event: 'upload-success', callback: UploadSuccessCallback): this + once = {}>(event: 'complete', callback: UploadCompleteCallback): this + once(event: Event, callback: (...args: any[]) => void): this off(event: Event, callback: (...args: any[]) => void): this /** * For use by plugins only. diff --git a/packages/@uppy/core/types/index.test-d.ts b/packages/@uppy/core/types/index.test-d.ts index 412b159a2..a143c3bdb 100644 --- a/packages/@uppy/core/types/index.test-d.ts +++ b/packages/@uppy/core/types/index.test-d.ts @@ -81,13 +81,17 @@ import DefaultStore = require('@uppy/store-default') // can emit events with custom event types uppy.emit('dashboard:modal-closed', () => {}) - // can register listners for internal events + // can register listeners for internal events uppy.on('upload', () => {}) uppy.on('complete', () => {}) uppy.on('error', () => {}) + uppy.once('upload', () => {}) + uppy.once('complete', () => {}) + uppy.once('error', () => {}) - // can register listners on custom events + // can register listeners on custom events uppy.on('dashboard:modal-closed', () => {}) + uppy.once('dashboard:modal-closed', () => {}) } {