
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ember-deep-buffered-proxy
Advanced tools
Wrap your data in a proxy that buffers all changes - meaning that you can control when and whether they get applied on source data.
There is plenty of buffer proxy or changeset Ember addons, this one tries to unite all these ideas in one addon:
If you are using EmberData, there is a more specialized addon called Ember Data Fork.
ember install ember-deep-buffered-proxy
import buildProxy from 'ember-deep-buffered-proxy';
let model = {
name: 'Cookie Monster',
address: {
street: 'Sesame St.'
},
friends: [
{ name: 'Bert' },
{ name: 'Ernie' }
]
};
let buffer = buildProxy(model);
buffer.set('name', 'Big Bird');
buffer.get('address').set('street', 'Sesame Street');
buffer.get('friends').popObject();
buffer.get('friends').addObject({ name: 'Elmo' });
// model has not changed
buffer.dbp.hasChanges; // true
buffer.dbp.applyChanges();
// model received the changes
buffer.dbp.hasChanges; // false
To prevent attribute name collision, all buffer methods and attributes are wrapped
inside an object that is available under dbp key. If you don't like this name,
you can set your own namespace in the configuration.
By default Ember Deep Buffered Proxy uses JSON serialization and strict equality
to compare old and new values. That means that for example two Date instances
are considered same as long as they have same time value. If this mechanism
doesn't work for you, you can always provide your own serialization method in options:
let buffer = buildProxy(model, {
serialize(v) {
return v; // use actual value without any serialization
}
});
Ember Deep Buffered Proxy ships with two classes: ObjectProxy and ArrayProxy.
Each of them has its own driver class (ObjectProxy.Driver and ArrayProxy.Driver) -
that's the class that gets instantiated under the namespace hook.
Here's a general idea how to extend these classes or define custom proxy class:
import { isArray } from '@ember/array';
import buildProxy, { ObjectProxy, ArrayProxy } from 'ember-deep-buffered-proxy';
const MyObjectProxyDriver = ObjectProxy.Driver.extend({
});
const MyObjectProxy = ObjectProxy.extend({
}).reopenClass({
Driver: MyObjectProxyDriver
});
export default function(content) {
return buildProxy(content, {
proxyClassFor(obj) {
return isArray(obj) ? ArrayProxy : MyObjectProxy;
}
});
}
To override default configuration just define your settings in config/environment.js
under deepBufferedProxy key. These are all available options:
{
namespace: 'dbp' // key under which buffer methods and attributes are available
}
See the Contributing guide for details.
This project is licensed under the MIT License.
FAQs
Change buffering proxy for Ember Objects, arrays, promises
We found that ember-deep-buffered-proxy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.