1.0.0 • Published 8 years ago
ember-cli-array-limit v1.0.0
ember-cli-array-limit
Ember CLI array limit addon.
ember-cli-array-limit
exposes an Ember ArrayProxy subclass
which returns only the content array items before a certain limit.
Example
import Ember from 'ember';
import ArrayLimit from 'array-limit';
var arr = Ember.A(['a', 'b', 'c', 'd', 'e', 'f']);
var proxy = ArrayLimit.create({
content: arr,
limit: 3
});
console.log(proxy.toArray()); // ['a', 'b', 'c']
proxy.incrementProperty('limit');
console.log(proxy.toArray()); // ['a', 'b', 'c', 'd']
arr.unshiftObject('x');
console.log(proxy.toArray()); // ['x', 'a', 'b', 'c']
Properties
content
: Ember.Array (optional, default = null
)
The content array. Must be an object that implements Ember.Array
and/or
Ember.MutableArray
. See Ember.ArrayProxy#content
.
limit
: Number (optional, default = Infinity
)
This value determines the maximum number of elements to allow.
Installing
With npm:
$ npm install --save-dev ember-cli-array-limit
Or with Ember CLI:
$ ember install ember-cli-array-limit