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

ember-cli-simple-store

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-simple-store - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

addon/model.js

2

package.json
{
"name": "ember-cli-simple-store",
"version": "0.1.1",
"version": "0.2.0",
"description": "ember-cli addon that provides a simple identity map for ember.js web applications",

@@ -5,0 +5,0 @@ "directories": {

@@ -154,6 +154,29 @@ # ember-cli-simple-store

## What about the missing MyObject.save() abstraction
## What about dirty tracking?
Because this is a simple identity map you won't get a rich model object to inherit from that offers up save/remove/update/find. You can think of this store as the primitive in which to build something like that if and when you need it.
If you want the ability to track if your model is dirty use the attr for each field and the Model base class to get save/rollback
```js
import { attr, Model } from "ember-cli-simple-store/model";
var Person = Model.extend({
firstName: attr(),
lastName: attr(),
fullName: function() {
var first = this.get("firstName");
var last = this.get("lastName");
return first + " " + last;
}.property("firstName", "lastName")
});
//save your object to reset isDirty
var person = Person.create({id: 1, firstName: 'x', lastName: 'y'});
person.set('firstName', 'toran');
person.save();
//rollback your object to reset isDirty and restore it
person.set('firstName', 'foobar');
person.rollback();
```
## Running the unit tests

@@ -160,0 +183,0 @@

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