Giter VIP home page Giter VIP logo

ember-cli-loading-slider's Introduction

Loading-slider

A loading indicator component for EmberJS that animates across the top of the viewport.

Live Demo

Build Status

Installation

npm install ember-cli-loading-slider --save-dev

Usage

Add the component to your application template:

{{loading-slider isLoading=loading duration=250}}

Alternatively you may try the more complex mode. In this mode an array of colors is required hexColorsArray: ['#000', '#fff']:

{{loading-slider isLoading=loading expanding=true color=hexColorsArray}}

Create application route (if not present) and extend application route with loading-slider mixin:

import Ember from 'ember';
import LoadingSliderMixin from '../mixins/loading-slider';

export default Ember.Route.extend(LoadingSliderMixin, { });

The animation will now show when the user navigates between routes that return a promise (such as this.store.find()).

You may also show or hide the animation at any time from any route or controller:

actions: {
  saveUser: function(user) {
    var self = this;

    self.send('loading');
    user.save().finally(function() {
      self.send('finished');
    });
  }
}

For v1.2.x make sure that you have explicitly defined an application controller e.g. app/controllers/application.js to avoid getting an Assertion Failed error.

v1.3.x is implemented as a service and controllers are no longer used.

API

  • isLoading
    • A boolean property that the component observes to determine if it should display or hide.
  • duration
    • An approximate duration of the event in milliseconds. Defaults to 300. Once 75% of this specified duration passes (or if the animation reaches 66% of the viewport width the animation slows until either isLoaded changes to false or it reaches 100% of the viewport width. This option is only valid for the simple stripe animation.
  • color
    • A css color to use for the animation stripe. Defaults to red. Can also be set with your application's css by setting the background-color of .loading-slider > span. If expanding is set to true then color is required and must be an array of colors.
  • expanding
    • Set this to true to change the style of animation from a simple stripe to a more complex animation (see the demo).
  • speed
    • Set the speed of the expanding style animation. Defaults to 1000. Only valid when expanding is true.

Service API

For advanced usage you may interact directly with the service instead of or in addition to using the loading-slider component.

  • startLoading
  • endLoading
  • changeAttrs(attrs)

Authors

Legal

Copyright (c) 2014 Jerel Unruh

Licensed under the MIT license

ember-cli-loading-slider's People

Contributors

asaf avatar baltazore avatar cibernox avatar dasnixon avatar davsket avatar jerel avatar leizhao4 avatar mlalic avatar olleolleolle avatar scottkidder avatar tushar-chauhan avatar willviles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ember-cli-loading-slider's Issues

css is not getting imported

i had to manually copy paste the css from loading-slider.css to my app.scss to make it run.
css is not getting imported automatically.

Documentation: expanded should be a boolean instead of a string

The current readme shows the following code for adding an expanding slider to your template:

{{loading-slider isLoading=loading expanding="true" color=hexColorsArray}}

Because the expanding property is listed in classNameBindings, the component's element is given a class matching the string value of this property: true.

To get a class value of expanding as expected, I had to pass expanding's value as a boolean instead of a string:

{{loading-slider isLoading=loading expanding=true color=hexColorsArray}}

Using Ember 1.10.0

Not working with Ember cli 1.13.12

Hi.
Just update my app to 1.13.12 and I'm having this issue

version: 1.13.12
Could not find watchman, falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/user-guide/#watchman for more info.
[Deprecated] new this.Funnel(..) is deprecated, please use broccoli-funnel directly instead  [addon: ember-cli-loading-slider]
Livereload server on http://localhost:49152
Serving on http://localhost:4200/
ENOENT: no such file or directory, stat '/home/julian/Developer/work/sciensa/cvc-intercambio-frontend/tmp/concat_with_maps-input_base_path-bd66fPQ0.tmp/0/components/loading-slider.css'
Error: ENOENT: no such file or directory, stat '/home/julian/Developer/work/sciensa/cvc-intercambio-frontend/tmp/concat_with_maps-input_base_path-bd66fPQ0.tmp/0/components/loading-slider.css'

Import path error

I used this import with my ember-cli project:

import LoadingSliderMixin from '../mixins/loading-slider';

but now I am getting an error:

Uncaught Error: Could not find module `client/mixins/loading-slider` imported from `client/routes/application`

What am I missing?

Import path

Hi, thank you for this addon! I couldn't find the correct path for importing it into my application route. Tried many different but the one in the readme didn't work either. And I did install the addon and see it in node_modules.

import LoadingSliderMixin from '../mixins/loading-slider';

File: app/routes/application.js ENOENT, no such file or directory '/Users/oskar/Sites/radio4000/tmp/tree_merger-tmp_dest_dir-LJoslqM3.tmp/app/mixins/loading-slider.js' Error:

addon call didRender component

Hi.
I have a problem

On a page with component, the component's didRender hook runs when I use the addon and go to other page (transition)

I've tried other components and the same thing happens.

IF I remove the addon all works well.

¿?

Deprecation Warning

I'm using Ember 2.18.0 and after installing the package and using {{loading-slider isLoading=loading duration=250}}, I get the following deprecation warning:

DEPRECATION: An addon is trying to access project.nodeModulesPath. This is not a reliable way to discover npm modules. Instead, consider doing: require("resolve").sync(something, { basedir: project.root }).

Nested routes fire "loading" action twice

I realize this is probably not a bug but I was wondering how folks handle nested routes? How do you suppress the "loading" action on the parent route to avoid duplicating loading bar?

Remove jQuery requirement

The default in Ember from 3.14 is to not include jQuery. Therefore, we can no longer expect it to be there for all users.

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.