-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite in proper factory format as per v2 & bump version
- Loading branch information
Ben Smithett
committed
Oct 15, 2014
1 parent
0f95a5c
commit da1086c
Showing
5 changed files
with
29 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bower_components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]>" | ||
|
@@ -14,6 +14,7 @@ | |
"ignore": [ | ||
"**/.*", | ||
"README.md", | ||
"test.html" | ||
"test.html", | ||
".gitignore" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
window.viewloader = { | ||
execute: function( views, $scope ) { | ||
var $els = $scope ? $scope.find( "[data-view]" ) : $( "[data-view]" ); | ||
|
||
$els.each( function( i, el ) { | ||
var $el = $( el ); | ||
var view = $el.data( "view" ); | ||
if ( view && views[ view ] ) { | ||
views[ view ]( $el, el ); | ||
(function (root, factory) { | ||
root.viewloader = factory({}, (root.jQuery || root.Zepto || root.$), root); | ||
}(this, function(viewloader, $, root) { | ||
"use strict"; | ||
|
||
viewloader.execute = function (views, $scope) { | ||
var $els = $scope ? $scope.find("[data-view]") : $("[data-view]"); | ||
|
||
$els.each(function(i, el) { | ||
var $el = $(el); | ||
var view = $el.data("view"); | ||
if (view && views[view]) { | ||
views[view]($el, el); | ||
} | ||
}); | ||
} | ||
}; | ||
}; | ||
|
||
return viewloader; | ||
})); |