Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-buffered-array-proxy

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-buffered-array-proxy

An Ember Array Proxy the enables change buffering

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
32
increased by128.57%
Maintainers
1
Weekly downloads
 
Created
Source

ember-buffered-array-proxy Build Status npm version

An Ember Array Proxy (and mixin) the enables change buffering. Ever need to "hold back" array changes before they propagate? If so this may be the project for you.

This project follows similar API structure as ember-buffered-proxy.

Usage

ember install ember-buffered-array-proxy
import BufferedArrayProxy from 'ember-buffered-array-proxy/proxy';

const content = [ 'A' ];
const buffer = BufferedArrayProxy.create({ content });

buffer.get('firstObject'); // => 'A'
buffer.addObject('B');

buffer.objectAt(1); // => 'B'
buffer.toArray(); // => ['A', 'B']

buffer.get('hasChanges'); // => true
buffer.get('changes'); // => (get an object describing the changes) -- { added: ['B'], removed: [] }

buffer.applyBufferedChanges();

buffer.toArray(); // => ['A', 'B']
content.toArray(); // => ['A', 'B']
buffer.get('hasChanges'); // => false

buffer.removeObject('A');
buffer.get('changes'); // => { added: [], removed: ['A'] }
buffer.hasChanged(); // => true

buffer.discardBufferedChanges();

buffer.toArray(); // => ['A', 'B']
content.toArray(); // => ['A', 'B']
buffer.hasChanged(); // => false

You can also use these shorter method names

buffer.discardChanges(); // equivalent to buffer.discardBufferedChanges()
buffer.applyChanges();   // equivalent to buffer.applyBufferedChanges()

Or you can grab the mixin directly

import BufferedArrayMixin from 'ember-buffered-array-proxy/mixin';

const content = ['A']
const buffer = ArrayProxy.extend(BufferedArrayMixin).create({ content });

// same as above

Keywords

FAQs

Package last updated on 08 Jan 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc