simplajs / simpla

Open, modular, and serverless content management for a modern web
https://www.simplajs.org
MIT License
527 stars 36 forks source link

Add buffer state #68

Closed bedeoverend closed 7 years ago

bedeoverend commented 7 years ago

Adds in a public buffer state. Initially, this just allows users to check if a given path has been modified locally i.e. that the data in the buffer is different to the remote data e.g.

let buffer = Simpla.getState('buffer');

this.modified = buffer[this.path].modified;

or for example to check if any changes have been made to anything on the page:

let buffer = Simpla.getState('buffer');

this.unsavedChanges = Object.keys(buffer).some(key => buffer[key].modified);