diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d4ae25 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +bower_components diff --git a/README.md b/README.md index 54be686..a25002c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Add `data-view` attributes to your HTML: Create an object for your app that lists setup functions for each type of view. ```javascript -myApp.views = { +MyApp.Views = { dropdown: function( $el ) { $el.fancyDropdown(); }, chatWindow: function( $el, el ) { new ChatWindowView({ el: el }); }, // ... etc etc @@ -23,10 +23,12 @@ myApp.views = { Once the DOM is ready, run: ```javascript -viewloader.execute( myApp.views ); +viewloader.execute( MyApp.Views ); ``` -viewloader will find every element on the page with a `data-view` attribute and call its setup function with 2 arguments: +viewloader will find every element on the page with a `data-view` attribute and check to see if a function with that name exists on the supplied object. + +If such a function exists, it will be called 2 arguments: - `$el`: the jQuery-wrapped DOM element (i.e. `$(el)`) - `el`: the DOM element diff --git a/bower.json b/bower.json index a1b3044..928663e 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "viewloader", "main": "viewloader.js", - "version": "1.0.0", + "version": "1.0.1", "homepage": "https://github.com/bensmithett/viewloader", "authors": [ "Ben Smithett " @@ -14,6 +14,7 @@ "ignore": [ "**/.*", "README.md", - "test.html" + "test.html", + ".gitignore" ] } diff --git a/test.html b/test.html index 9f9d7b3..bb09ecd 100644 --- a/test.html +++ b/test.html @@ -12,14 +12,15 @@
- - +