Last active
August 29, 2015 14:05
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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