Code Monkey home page Code Monkey logo

event-spinner's Introduction

##event-spinner

event-spinner is a simple html element based on FontAwesome icons which works with the help of EventEmitter

Guide

1. Installation

npm install --save event-spinner

2. Add FontAwesome to your css
NOTE: This can be change at anytime
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
3. Initialize event-spinner with options in your application
import eventSpinner from 'event-spinner';

const config = {
    spinner: 'fa-spinner', // icon to spin
    animation: 'fa-spin', // animation type
    size: 'fa-3x', // icon size 
    fixed: true, // use fa-fw or no
    rgba: [255, 255, 255, 0.5], // rgba color
    container: 'app', // id of container where spinner should be used
    z: 8000, // z-index
    top: 50, // position from top
    left: 50, // position from left
};
export const spinner = new eventSpinner(config);
4. Import your initialized spinner and use
import { spinner }  from './initializedSpinner';

const getSomeData = () => {
    spinner.showSpinner();
    fetch('someurl')
        .then((res) => {
            spinner.hideSpinner();
            // process results
        })
        .catch((err) => {
            spinner.hideSpinner();
            // do smth with error
        })
};

default props: In case you don't pass the props

    {
         spinner: 'fa-spinner',
         animation: 'fa-spin',
         size: 'fa-3x',
         fixed: true,
         rgba: [255, 255, 255, 0.5],
         container: 'app',
         z: 8000,
         top: 50,
         left: 50,
     }

Example

You can checkout the demo in example folder by downloading and running demo.html in your browser

TODO

create test.

event-spinner's People

Contributors

afotescu avatar nfotescu avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

nfotescu

event-spinner's Issues

Add support for IE

I tried it in Internet Explorer and it didn't work. Any way to make it work? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.