0.1.0 • Published 9 years ago
ember-cli-once v0.1.0
ember-cli-once
Ember CLI one-time calculation addon.
ember-cli-once
exposes a factory which limits a function's executions. Its
return value will be calculated on first execution and cached. Subsequent calls
will immediately return the cached result.
Example
import Ember from 'ember';
import once from 'once';
var i = 0;
var foo = Ember.Object.create({
increment: once(function () {
// only ever hit once
return ++i;
})
});
foo.increment(); // -> 1
foo.increment(); // -> 1
Installing
With npm:
$ npm install --save ember-cli-once
Or with Ember CLI:
$ ember install ember-cli-once
License
0.1.0
9 years ago