From 3278889e1063902c4aa8842ac6f208272edf2aed Mon Sep 17 00:00:00 2001 From: Dugan Knoll Date: Wed, 14 May 2014 16:45:23 -0700 Subject: [PATCH] getting documentation ready for presentation --- About-Ractive.md | 16 +++++++++++++--- README.md | 20 ++++++++++++-------- index.html | 16 ++++++++-------- js/instagram.js | 6 ++---- js/main.js | 37 ++++++++++++++++++++----------------- 5 files changed, 55 insertions(+), 40 deletions(-) diff --git a/About-Ractive.md b/About-Ractive.md index f0721a4..6c179e4 100644 --- a/About-Ractive.md +++ b/About-Ractive.md @@ -7,17 +7,17 @@ Too many javascript applications contain repetitive code. First, you select a a I love jQuery, but this is bad practice. Too many lines of code and searching by css selectors will slow down your code. -## The JS Framework approach +## The JS MVC approach There are plenty of shiny new javascript frameworks to help you be organized and efficient while writing code: [ToDoMVC - JS Frameworks listing](http://todomvc.com/) -These frameworks provide methods for ajax requests, templating, code-compiling, testing, data-binding, and much more. +Most of these applications enforce an MVC model to seperate dependencies, updating, and flow-control. These frameworks provide methods for ajax requests, templating, code-compiling, testing, data-binding, and much more. ## The Ractive Approach -Ractive does one thing and it does one thing wonderfully. Binding a JSON data object to an HTML model. Take a quick look at this sample code. +Ractive does one thing and it does one thing wonderfully. Binding a JSON data object to an HTML view. Take a quick look at this sample code. #### HTML @@ -38,3 +38,13 @@ Ractive does one thing and it does one thing wonderfully. Binding a JSON data o template: '

{{greeting}}, {{recipient}}!

', data: { x: 5, y:6 , title: 'Multiplying Numbers'} }); + + +That was easy, right? Alright, now you have a ractive javascript object and an html template rendered. Try checking the data model using `ractive.get()`. + +Now you can update the HTML at any time by using ractive.set(). Lets try for example, `ractive.set('x', 10);`. As you can see, the + + +### Ractive is deterministic + +Having all of your data bound into one data structure is actually pretty incredible. You have a Single Source of Truth (SSOT) data object and your HTML template is deterministic. By deterministic, I mean there is one state that your HTML will be in for a specific data structure (unless some other javascript messed with the template). \ No newline at end of file diff --git a/README.md b/README.md index d12ef1c..4937688 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ Sample Usage: - /** This code is just for the infinite scroll. You don't have to use this. */ @@ -24,13 +23,18 @@ Sample Usage: }); } - //Create New Instagram Feed - insta = new instagramFeed({ - el: 'template-target', - template: template, - clientID: 'Your Instagram Client ID', - hashtag: 'webdesign', - complete: infiniteScrollBinding + // Get our template file. + $.get( 'templates/twitter-feed.rac').then( function ( template ) { + + //Create New Instagram Feed + insta = new instagramFeed({ + el: 'template-target', + template: template, + clientID: 'Your Instagram Client ID', + hashtag: 'webdesign', + complete: infiniteScrollBinding + }); + }); diff --git a/index.html b/index.html index 80228ad..76c51e0 100755 --- a/index.html +++ b/index.html @@ -55,16 +55,16 @@ - +