Skip to content

Commit

Permalink
Updating README
Browse files Browse the repository at this point in the history
  • Loading branch information
ifandelse committed Oct 19, 2011
1 parent 348f0c0 commit 74b8dab
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# infuser
# Infuser

## What is it?
infuser is a JavaScript library you can use to retrieve templates (or other files) asynchronously (or synchronously, if you prefer).
Infuser is a JavaScript library you can use to retrieve templates (or other files) asynchronously (or synchronously, if you prefer).

## Why would I use it?
* It provides a consistent way to access external view data from the client.
Expand All @@ -20,15 +20,12 @@ JavaScript:
// Pulling static content
// When the DOM is ready...
$(function(){
// Tell infuser's configuration to look for a templates directory if this page requests any templates
infuser.config.templateUrl= "./templates",
// Tell infuser's configuration to look for templates with an ".html" suffix (this is a default value, just showing as an example)
infuser.config.templateSuffix= ".html"
// Tell infuser's configuration to look for templates with a "tmpl_" prefix
infuser.config.templatePrefix = "tmpl_";
infuser.config.templateUrl= "./templates",// look for templates in a "templates" directory (relative to this page)
infuser.config.templateSuffix= ".html" // look for templates with an ".html" suffix (this is a default value, just showing as an example)
infuser.config.templatePrefix = "tmpl_"; // look for templates with a "tmpl_" prefix
// Now - wire up a click event handler that asynchronously fetches a static html file and appends it to an element
$('#btnTemplate').click(function(){
infuser.fetch("HelloWorld", function(template){
infuser.get("HelloWorld", function(template){
$("#target").hide();
$("#target").children().remove().end();
$("#target").append($(template)).fadeIn();
Expand All @@ -41,7 +38,7 @@ JavaScript:
$(function(){
$('#btnTemplate').click(function(){
infuser.config.templateUrl= "./templates",
infuser.fetch("Example", function(template){
infuser.get("Example", function(template){
$("#target").hide();
$("#target").children().remove().end();
var div = $("<div />");
Expand All @@ -52,7 +49,7 @@ JavaScript:
});

## What about dependencies?
infuser takes a dependency on jQuery (1.4 or greater).
Infuser takes a dependency on jQuery (1.4 or greater).

In order to run the samples under the example folder, you need to:

Expand Down

0 comments on commit 74b8dab

Please sign in to comment.