Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

TypeScript support, setStatus via API, cleanup large Blobs in memory

Compare
Choose a tag to compare
@rnicholus rnicholus released this 17 Feb 05:11
· 85 commits to master since this release

Features

TypeScript support

A comprehensive TypeScript definition file that covers the entire API is not included in the build output. TypeScript users will now be able to benefit from type-checking when working with Fine Uploader in a TypeScript environment. The package.json file has been updated appropriately so TypeScript should be able to discover the definition file without issue. If you are already using the definitions on DefinitelyTyped, please switch to the definitions bundled with the library as the DefinitelyTyped records will be removed/deprecated in the near future. See #1719 for more details on implementation of this integration.

New API method - setStatus(id, newStatus)

Initially, only qq.status.DELETED and qq.status.DELETE_FAILED are supported. All other statuses will throw a qq.Error. This can be used to mark a file as deleted, or to indicate that a delete attempt failed if you are using delete file logic outside of Fine Uploader's control. This will update the UI by removing the file if you are using Fine Uploader UI as well.

For example:

// marks file with ID of 3 as deleted
uploader.setStatus(3, qq.status.DELETED)

Docs at http://docs.fineuploader.com/branch/develop/api/methods.html#setStatus

re:

New API method - removeFileRef(id)

Documented at http://docs.fineuploader.com/branch/develop/api/methods.html#removeFileRef.

This allows you to free any memory associated with a client-side generated Blob. This is something you might want to do after the file has been successfully uploaded. For example:

var uploader = new qq.FineUploaderBasic({
    request: {
        endpoint: '/my/upload/endpoint'
    },
    callbacks: {
        onComplete: function(id, name, response) {
           if (response.success && this.getFile(id).inMemoryBlob) {
              this.removeFileRef(id)
           }
        }
    }
})

// elsewhere
var someBlobCreatedClientSide = createBlob(...)
someBlobCreatedClientSide.inMemoryBlob = true

uploader.addFiles(someBlobCreatedClientSide)

re: #1711

Fixes

  • The Makefile was updated to ensure builds execute correctly in a Windows/Cygwin environment. More details in #1698.