ember-buffered-proxy
An Ember Object Proxy (and mixin) the enables change buffering. Ever need to "hold back" property changes before they propagate? If so this may be the project for you.
Usage
ember install ember-buffered-proxy
import BufferedProxy from 'ember-buffered-proxy/proxy';
var content = {
firstName: 'stefan'
};
var buffer = BufferedProxy.create({
content: content
});
buffer.get('firstName');
buffer.set('firstName', 'Kris');
buffer.get('firstName');
buffer.get('content.firstName');
buffer.get('hasChanges');
buffer.buffer;
buffer.applyBufferedChanges();
buffer.get('firstName');
buffer.get('content.firstName');
buffer.get('hasChanges');
buffer.set('firstName', 'Luke');
buffer.get('firstName');
buffer.get('content.firstName');
buffer.hasChanged('firstName');
buffer.discardBufferedChanges();
buffer.get('firstName');
buffer.get('content.firstName');
buffer.hasChanged('firstName');
buffer.set('email', 'example@example.com');
buffer.get('email');
buffer.get('content.email');
buffer.set('address', '123 paradise road');
buffer.get('address');
buffer.get('content.address');
buffer.applyBufferedChanges(['email']);
buffer.get('email');
buffer.get('address');
buffer.get('content.email');
buffer.get('content.address');
buffer.setProperties({
email: 'sample@sample.com',
address: '1717 rose street'
});
buffer.discardBufferedChanges(['address']);
buffer.get('email');
buffer.get('address');
You can also use these shorter method names
buffer.discardChanges();
buffer.applyChanges();
Or you can grab the mixin directly
import BufferedMixin from 'ember-buffered-proxy/mixin';
var content = {
firstName: 'stefan'
};
var buffer = ObjectProxy.extend(BufferedMixin).create({
content: content
});
development
Installation
git clone
this repositoryyarn install
bower install
Running
Running Tests
ember test
ember test --server
Building
For more information on using ember-cli, visit http://www.ember-cli.com/.