JQuery oop blueprint basic


While working on JQuery Class I realize I need to document this code blueprint for the future purposes, just in case I’m lost 🙂

test_class.js
var TestClass = function($) {
 'use strict';

var self = this;

//method that is bind with (self / this) is callable outside the class
 self.test = function() {
      console.log("This is a test");
 }

//another public method to bind all events, click, change etc..
self.bindAll = function() {

};

//private method
 var privateTest = function() {

 };

};

Instantiate the class then call the method test

$(document).ready(function() {
 var TestClassObj = new TestClass($);
 TestClassObj.test();
 TestClassObj.bindAll();
});

Feel free to comment below and correct me if wrong or miss something. Thanks 🙂

Published by

Emisyl

Is a web developer and a Php enthusiasts base in the Philippines

Other sites
https://planetcodes.blogspot.com

Leave a Reply

Your email address will not be published. Required fields are marked *

Emisyl