From 18cb3afba498c7b90e88d3e57629b1ec5082875f Mon Sep 17 00:00:00 2001 From: Mark Nadal Date: Thu, 25 Jun 2015 13:16:20 -0700 Subject: [PATCH] make get lazy --- examples/index.html | 2 +- gun.js | 18 ++++- lib/file.js | 3 +- test/common.js | 26 +++++- web/editor.html | 16 +--- web/think.html | 188 +++++++++++++++++++++++++++++++------------- 6 files changed, 180 insertions(+), 73 deletions(-) diff --git a/examples/index.html b/examples/index.html index 17466042..87268da9 100644 --- a/examples/index.html +++ b/examples/index.html @@ -1,6 +1,6 @@ -

Examples Directory

+

Examples Directory

- + @@ -45,7 +35,7 @@ var editor = CodeMirror.fromTextArea($('textarea')[0], { mode: "text/html", tabSize: 2 }); - +editor.live = function(cb){ editor.cb = cb || editor.cb } editor.on("change", function change() { clearTimeout(change.throttle); change.throttle = setTimeout(live, 100); @@ -53,10 +43,10 @@ editor.on("change", function change() { function live() { var frame = $('iframe').height($('.CodeMirror').height() * .95)[0]; - $('iframe').height($('.CodeMirror').height()); frame = frame.contentDocument || frame.contentWindow.document; frame.open(); frame.write(editor.getValue()); + (editor.cb || function(){})(frame); frame.close(); } setTimeout(live, 100); diff --git a/web/think.html b/web/think.html index f9714dc2..5fdaf5bd 100644 --- a/web/think.html +++ b/web/think.html @@ -9,12 +9,12 @@

Before we can start building anything interesting, we should have a way to jot down our thoughts. Therefore the first thing we will build is a tool to keep track of what needs to be done. The infamous To-Do app, allowing us to keep temporary notes.

-

So what are the requirements? The ability to add a note, read our notes, and to clear them off. Additionally, we need a space to keep these notes in, and a web page to access them through. Let's start with the page! You can edit the code below.

+

So what are the requirements? The ability to add a note, read our notes, and to clear them off. We will also need a space to keep these notes in, and a web page to access them through. Let's start with the page! You can edit the code below, which will update the live preview.

-
... loading editor ... +
... loading editor and preview ...
- +