Created
December 14, 2015 11:26
-
-
Save bjoerntx/4de5993601be65164935 to your computer and use it in GitHub Desktop.
This file contains 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
TXTextControl.addEventListener("ribbonTabsLoaded", function (e) { | |
restoreDocument(); | |
var intervalAutoSave = setInterval(autoSaveDocument, 5000); | |
}); | |
function autoSaveDocument() { | |
TXTextControl.saveDocument(TXTextControl.streamType.InternalUnicodeFormat, function (e) { | |
localStorage.document = e.data; | |
}); | |
} | |
function restoreDocument() { | |
if (localStorage["document"]) { | |
TXTextControl.loadDocument( | |
TXTextControl.streamType.InternalUnicodeFormat, | |
localStorage.document); | |
$(".info").css("display", "inline-block"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment