From 5a932cc8a8b9516e5824a1c6f5fc6ba15b304ab3 Mon Sep 17 00:00:00 2001 From: Christian Genco Date: Mon, 6 Apr 2015 20:37:39 -0500 Subject: [PATCH] add local storage --- index.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index abf9507..db6d3f3 100644 --- a/index.html +++ b/index.html @@ -93,10 +93,17 @@ editor.getSession().setMode("ace/mode/markdown") editor.getSession().setUseWrapMode(true) editor.renderer.setShowPrintMargin(false) +# do we have anything saved? +if essay = localStorage?.getItem('essay') + editor.getSession().setValue(essay) + refreshTimer = null editor.getSession().on 'change', -> clearTimeout(refreshTimer) - refreshTimer = setTimeout(refresh, 1000) + refreshTimer = setTimeout(-> + refresh() + localStorage?.setItem('essay', editor.getSession().getValue()) + , 1000) window.refresh = -> stream = blobStream()