file-loader-x

0.9.0 • Public • Published

file-loader-x

NPM version Clean Code Dependency Status devDependency Status License

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

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)

Dependents (0)

Package Sidebar

Install

npm i file-loader-x

Weekly Downloads

1

Version

0.9.0

License

MIT

Last publish

Collaborators

  • wenwu