Last active
December 30, 2015 20:29
-
-
Save elisechant/7880805 to your computer and use it in GitHub Desktop.
JS Module Prototype Skeleton
This file contains hidden or 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
var MyNamespace = MyNamespace || {}; | |
(function ($) { | |
"use strict"; | |
var $w = $(window), | |
BU = MyNamespace.Util | |
; | |
MyNamespace.ArticleItem = function(el) { | |
this.el = '#page-test'; | |
var me = this | |
, $scope = $(me.el) | |
; | |
if ( !!( $scope && $scope.length ) == false ) { | |
// throw "No element or no valid element given for the API_test item"; | |
return; | |
} | |
me.initEvents(); | |
// assign instance properties | |
me.el = el; | |
me.id = el.attr('id'); | |
// init each | |
// initialises the prototype.init | |
$($.proxy(me.init, me)); | |
}; | |
MyNamespace.ArticleItem.prototype = { | |
el: null, | |
id: '', | |
init: function() { | |
console.log(this.el) | |
} | |
}; | |
}(jQuery)); | |
// instantiate | |
// loop through for all item | |
var item = new MyNamespace.ArticleItem( item ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment