🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

bacon-form-saving

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bacon-form-saving

Streaming an object from a web form to a server, and back again

latest
Source
npmnpm
Version
2.0.1
Version published
Maintainers
1
Created
Source

For a single row in a database somewhere, and a single web form that lets you edit that data in real time.

Create a BaconJS stream of objects whose properties are the column identifiers and whose values are the new values entered by the user: { name: 'Josh' }

Call the function exported by this module, passing in

  • that stream
  • an object containing the initial/current state of the object in the database
  • the name of the primary key column
  • a function that takes an object and a callback function, that saves the object and calls back with either an error, and if possible, the new state of the object in the database.

It's pretty opinionated. It handles populating a version value with whatever the latest version was on the object received from the server, and a primary key column populated from the initial state, or the latest object received from the server.

To check out the play/testing ground:

git clone git@github.com:TehShrike/ractive-saving-stuff.git
cd ractive-saving-stuff
npm install
npm run dev

FAQs

Package last updated on 26 Jan 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