el-spinner

0.2.6 • Public • Published

el-spinner

Build Status npm version Greenkeeper badge

Quickly make a text spinner for your HTML. Using cli-spinners.

demo

Install

npm install --save el-spinner

Usage

Include the javascript file in your HTML and make a new ElSpinner:

<script src="/path/to/el-spinner.min.js"></script>
<span id="el"></span>
<script>
  const spinner = new ElSpinner({
    /* options */
    el: document.getElementById('el')
  })
  spinner.start() // You should manually start the spinner
</script> 

You can also use it like this:

import ElSpinner from 'el-spinner'
 
let spinner = new ElSpinner({
  el: document.getElementById('el')
})
spinner.start()

API

methods

constructor(options)

start()

Start the spinner from the first frame.

stop()

Stop the spinner.

resume()

Resume the spinner.

toggle()

Toggle the spinner state between stop and resume.

remove()

Stop the spinner and then remove the text from the element.

set(options)

Pass a new option to the spinner.

options

Option Description Type Default
el The element where to display the spinner. Element -
type The type of the spinner. Please check the list String 'dots'
interval Interval between each frame. If not set, the value from the original spinner will be used Number -

Package Sidebar

Install

npm i el-spinner

Weekly Downloads

0

Version

0.2.6

License

MIT

Unpacked Size

43.4 kB

Total Files

9

Last publish

Collaborators

  • zoron