Socket
Socket
Sign inDemoInstall

ember-auto-save

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-auto-save

Ember auto save


Version published
Maintainers
1
Created
Source

Ember-auto-save

An Ember-cli addon that provides auto-save functionality for ember-data models.

Demo

http://lozjackson.github.io/ember-auto-save/

Installation

  • ember install ember-auto-save

Use

AutoSaveProxy

This is a computed property that provides an autoSaveProxy object. The autoSaveProxy object will proxy all requests to the model property. Setting properties on the autoSaveProxy object will be automatically saved.

Use this property in a controller or component. Set your model on the controller, then create an autoSaveProxy object for the model.

Example:

controller.js

import Ember from 'ember';
import autoSaveProxy from 'ember-auto-save';

export default Ember.Controller.extend({
  autoSaveProxy,
  model: model
});

template.hbs

{{input value=autoSaveProxy.name}}

AutoSaveComponent

You can use the AutoSaveComponent to wrap a model and provide an autoSaveProxy object.

{{#auto-save model=model as |autoSaveProxy|}}
  {{input value=autoSaveProxy.name}}
{{/auto-save}}

AutoSaveMixin

The AutoSaveMixin overrides the setUnknownProperty method, and triggers the save method when properties are set on the model.

The example below show how you can create your own autoSaveProxy object.

import AutoSaveMixin from 'ember-auto-save/mixins/auto-save';

let AutoSaveProxy = Ember.ObjectProxy.extend(AutoSaveMixin);

let autoSaveProxy =  AutoSaveProxy.create({
  content: this.get('model')
});

save() method

This method debounces the save method on the model provided. This method is useful for saving models from within code by calling save(model).

NOTE: This method does not auto-save the model, you have to manually call this method.

import { save } from `ember-auto-save`

save( model );

Optionally, you can provide a time to wait before applying the method. If no time value is specified then the default of 2000 (2 seconds) will be used.

// save the model after 5 seconds
save( model, 5000 );

Keywords

FAQs

Package last updated on 18 Jun 2016

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