diff --git a/README.md b/README.md index 6fd1caf..4281e05 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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(); @@ -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 = $("
"); @@ -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: