npm install file-loader-xfile-loader-x
=========
[![NPM version][icon-nv]][link-nv]
[![Clean Code][icon-cc]][link-cc]
[![Dependency Status][icon-ds]][link-ds]
[![devDependency Status][icon-dds]][link-dds]
![License][icon-li]
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][link-nv], I recommend you read it
on Github [file-loader-x][link-gh-pro-home], because on Github it is more readable.)
Desktop browsers support : Chrome, Safari, Firefox, Opera, IE10+
``shell`
jspm install npm:file-loader-x
* events-es5 ( An event dispatcher. )
`js
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.
`js
constructor: FileLoader
/**
* Destroy the instance.
* @return undefined
*/
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)
``
[link-gh-pro-home]: https://github.com/wenwuwu/file-loader-x
[icon-nv]: https://img.shields.io/npm/v/file-loader-x.svg?style=flat
[link-nv]: https://www.npmjs.com/package/file-loader-x
[icon-ds]: https://img.shields.io/david/wenwuwu/file-loader-x.svg?style=flat
[link-ds]: https://david-dm.org/wenwuwu/file-loader-x
[icon-dds]: https://img.shields.io/david/dev/wenwuwu/file-loader-x.svg?style=flat
[link-dds]: https://david-dm.org/wenwuwu/file-loader-x#info=devDependencies
[icon-cc]: https://img.shields.io/badge/code-clean-orange.svg?style=flat
[link-cc]: https://github.com/wenwuwu/code-convention-js
[icon-li]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat