Skip to content

runspired/rate-limit-computed

Repository files navigation

Rate-limit-computed

npm version Build Status Ember Observer Score Circle CI

Ember addon for debouncing or throttling a computed property. Interactive documentation is here: http://runspired.github.io/rate-limit-computed/.

Sometimes you need to debounce or throttle a computed property. In the past, doing so would usually require using an observer instead.

You'll still need to make sure your computed.debounce or computed.throttle are consumed somewhere, else they won't ever be updated.

dependencies devDependency Status

Installation

If you are on a recent version of ember-cli, do the following:

ember install rate-limit-computed

This is the equivalent of:

npm install --save-dev rate-limit-computed

Usage

import Ember from "ember";

const {
 computed
 } = Ember;
 
export default Ember.Component.extend({

  cubed: computed.throttle('foo', function() {
    var foo = this.get('foo');
    return foo * foo * foo;
  }, 16)

  count: 0,

});

In your template, you use the computed property just like normal.

{{cubed}}

About

Debounced and Throttled Computed Properties for Ember

Resources

License

Stars

Watchers

Forks

Packages

No packages published