Skip to content

Instantly share code, notes, and snippets.

@litzinger
Last active August 29, 2015 14:05
Show Gist options
  • Save litzinger/18db3198ec7420c65b15 to your computer and use it in GitHub Desktop.
Save litzinger/18db3198ec7420c65b15 to your computer and use it in GitHub Desktop.
How to add autosave support to 3rd party fieldtype in EE that uses a custom table.
// Add Autosave support
if(typeof EE.publish == "object" && EE.publish.autosave == "object" && EE.publish.autosave.interval > 10)
{
// 3 seconds before the defined interval
interval = (EE.publish.autosave.interval - 3) * 1000;
setInterval({
run: function() {
// Do whatever you need to do here, probably an ajax request, to save data to custom table.
}
}.run, interval);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment