file-loader-x
v0.9.0
Published
A Class that load files.
Downloads
3
Readme
file-loader-x
A component that load files. ( Currently only support image loading. The js files are in es6 syntax.)
( If you are reading this page on npmjs.org, I recommend you read it on Github file-loader-x, because on Github it is more readable.)
Browser support
Desktop browsers support : Chrome, Safari, Firefox, Opera, IE10+
Installation
jspm install npm:file-loader-x
Dependencies
- events-es5 ( An event dispatcher. )
Usage
var FileLoader = require('FileLoader');
this._imgLoader = new FileLoader(document.querySelector('#img-loader-wrapper'));
this._imgLoader.setType('image/*')
.events.bind('load', this._imgLoaded.bind(this));
/**
* `load` event listener will get noticed when a file is successfully
* loaded.
*
* @param FileLoader {FileLoader}
*/
_imgLoaded: function (FileLoader, image) {
// Now you have the image.
}
- Public interface in this component.
constructor: FileLoader
/**
* Destroy the instance.
* @return <em>undefined</em>
*/
destroy: function ()
/**
* @param classNames {String}
* @returns {FileLoader} A pointer to this instance, allowing call chaining.
*/
setCssClass: function (classNames)
/**
* Set upload file type.
*
* @param type {String}
* @returns {FileLoader} A pointer to this instance, allowing call chaining.
*/
setType: function (type)