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

Commit

Permalink
feat(wrappers): expose qq namespace via wrapper module named export
Browse files Browse the repository at this point in the history
  • Loading branch information
rnicholus committed Oct 17, 2017
1 parent 31df221 commit c3f1017
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 4 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,21 @@ You'll also need to explicitly install [Fine Uploader](https://github.com/FineUp
Note: You can access the entire `qq` namespace on any uploader instance. For example, if you are using Fine Uploader S3, and want to access the `status` object, your code may look something like this:

```js
import FineUploaderS3 from 'fine-uploader-wrappers/s3'

const uploader = new FineUploaderS3({ ... })
const queuedFileStatus = uploader.qq.status.QUEUED
```

_-or-_ via the wrapper module:

```js
import FineUploaderS3, { qq } from 'fine-uploader-wrappers/s3'

const uploader = new FineUploaderS3({ ... })
const queuedFileStatus = qq.status.QUEUED
```

#### Azure

This enables you to upload to Azure directly. Your server must provide signature and done endpoints. The Azure uploading workflow is documented on the [Azure feature page](http://docs.fineuploader.com/branch/master/features/azure.html). Some examples servers can be found in the [server-examples repository](https://github.com/FineUploader/server-examples).
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fine-uploader-wrappers",
"version": "1.0.1",
"version": "1.1.0",
"license": "MIT",
"description": "Fine Uploader core ES6 class wrappers that provide additional features.",
"author": {
Expand Down Expand Up @@ -55,7 +55,7 @@
"build": "rm -rf lib && mkdir -p lib && cp -pR src/ lib && babel lib --out-dir lib",
"lint": "eslint src/. --ext .js --cache",
"manual-test": "webpack --config config/webpack.manual-test.config.js --watch --display-error-details",
"push-to-npm": "cp package.json README.md LICENSE lib && (cd lib ; npm publish)",
"push-to-npm": "cp package.json README.md LICENSE lib && (cd lib ; npm publish --tag next)",
"release": "npm run test && npm run build && npm run push-to-npm",
"test": "npm run lint && if [ $CI ]; then karma start config/karma.conf; else karma start config/karma.dev.conf; fi"
}
Expand Down
2 changes: 2 additions & 0 deletions src/azure.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ export default class FineUploaderAzure extends BaseWrapper {
})
}
}

export { qq }
2 changes: 2 additions & 0 deletions src/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ export default class FineUploaderS3 extends BaseWrapper {
})
}
}

export { qq }
13 changes: 11 additions & 2 deletions src/test/unit/base-wrapper.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import qq from 'fine-uploader/lib/core'

import FineUploaderTraditional from 'src/traditional'
import FineUploaderTraditional, { qq as traditionalQq } from 'src/traditional'
import { qq as s3Qq } from 'src/s3'
import { qq as azureQq } from 'src/azure'


const sampleBlob = new Blob(['hi!'], { type : 'text/plain' })
const sampleBlobWrapper = { blob: sampleBlob, name: 'test' }
Expand Down Expand Up @@ -315,11 +318,17 @@ describe('Fine Uploader wrapper classes', () => {
}, 100)
})

it('provides access to the entire qq namespace', () => {
it('provides access to the entire qq namespace from wrapper instance', () => {
const wrapper = new FineUploaderTraditional({ options: {} })

expect(wrapper.qq).toBeTruthy()
expect(wrapper.qq.status.QUEUED).toBe('queued')
})

it('provides access to the entire qq namespace from wrapper export', () => {
expect(traditionalQq.status.QUEUED).toBe('queued')
expect(s3Qq.status.QUEUED).toBe('queued')
expect(azureQq.status.QUEUED).toBe('queued')
})
})
})
2 changes: 2 additions & 0 deletions src/traditional.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ export default class FineUploaderTraditional extends BaseWrapper {
})
}
}

export { qq }

0 comments on commit c3f1017

Please sign in to comment.