A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/modella/modella/wiki/Plugin-Writing-Guide below:

Plugin Writing Guide · modella/modella Wiki · GitHub

Storage Layer / Sync Plugins

A sync plugin is a Modella plugin that implements Model.save, Model.update, and Model.remove static methods which are invoked by model#save and model#remove with this bound to the model instance. See the memory plugin for a bare bones implementation.

A sync plugin must add the following methods to the Model class and implement the required callback signatures:

Model.save(function(error, attributes))

Model.save is called with this bound to the model instance. It must store the instance's attributes and execute the callback with arguments error and attributes.

This method saves the instance for the first time, so must include the newly created id in attributes.

Model.update(function(error, attributes))

Model.update has the same signature as Model.save but the instance already has a primary id field, as it was previously saved.

Model.remove(function(error))

Model.remove is called with this bound to the model instance. It must remove the instance from storage and execute the callback with an optional error argument.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4