npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-spin-button

v0.3.0

Published

A button with a spinner when pressed

Downloads

26

Readme

ember-spin-button

Creates a button with a nice spinner to the side. Design based upon Ladda, but implemented entirely as an Ember Component.

Demo

Installation

ember install ember-spin-button

Add the stylesheet include if it wasn't added automatically during installation:

// app/styles/app.scss
@import "spin-button";

Usage

{{#spin-button 
    action=(action "createUser")
    buttonStyle="expand-right"}}Create User{{/spin-button}}

You can manually bind something to indicate the busy state to inFlight, or simply return a promise from your action handler (Ember 1.13+) and the button will indicate a busy state while the promise is resolving.

The button will automatically disable itself when you click it, after calling the action.

Example Closure Action returning a promise:

Requires Ember 1.13

In Ember 1.13+, action handlers can have return values. If you return a promise in your action handler, ember-spin-button will automatically use the state of the promise to indicate progress.

// some-controller.js
import Ember from 'ember';

export default Ember.Controller.extend({
  actions: {
    saveRecord: function() {
      // Save returns a Promise from Ember Data which resolves when the model is saved.
      return this.get('model').save();
    },
  }
});
<!-- my-template.hbs -->
{{#spin-button action=(action "saveRecord")}}Save Changes{{/spin-button}}

Configuration

startDelay

A delay before showing the animation, but after disabling the button.

Default: 150ms. Any value <4ms will disable this feature.

inFlight (deprecated)

Binds the busy state of the button.

Default: false.

defaultTimout

A timeout after which the button will return to its default, non-in-flight state. Set to a falsy value to disable.

Default: 2E3. Any falsy value will disable this feature.

color

You can specify one of the predefined colors, or define your own using the buttonColor mixin:

@include buttonColor( 'red', #FF0000 );

Predefined colors:

  • green
  • purple
  • mint
  • red
  • blue

buttonStyle

  • expand-right
  • expand-left
  • expand-down
  • expand-up
  • contract
  • contract-overlay
  • zoom-in
  • zoom-out
  • slide-left
  • slide-right
  • slide-up
  • slide-down

Installation

  • git clone this repository
  • npm install
  • bower install

Running

  • ember server
  • Visit your app at http://localhost:4200.

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.