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
//Intro : Basic explanation of Javascript Inheritance concept | |
//there are many ways to achieve inheritance feature in Javascript | |
//this is one of the approach I follow most of the time. | |
//Declaring Parent Class/Function | |
//with three properties and one method | |
var ParentClass = function(property1, property2){ | |
this.Property1 = property1; | |
this.Property2 = property2; |
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
//Pre-requirements: knowing following concepts is good to understand DI in better way. | |
//1.SingleTon Design Pattern and usage | |
//2.'call' and 'apply' methods | |
//Intro: Below Code example is the basic explanation of Dependency Injection | |
//it explains how we can achieve DI with basic things. | |
//gives basic idea of how DI will work ,how to handle arguments | |
//Declaring the Dependency Injection Manager class/function |
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
//Javascript basic behaviour | |
//As we know, everything in javascript is goes as key value Pair but the difference is context | |
var Name = "Jason Bourne"; | |
//above code will declare variable called 'Name' and that is added to window object as below | |
console.log(window["Name"]); //prints 'Jason Bourne' in console | |
console.log(Name); //prints 'Jason Bourne' in console | |
//the context of variable declarassion is window, So we can access 'Name' in above ways | |
//either key of the window or direct variable name | |
//simple represenation of above variable under window is | |
//window = { |
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
//core method to handle execution | |
//has two arguments one is Array of methods that has to execute | |
//second param is enabling step by step execution. | |
function makeexecution(methodsArray, isStepbystep) { | |
//creating promise Object to return | |
var promise = {}; | |
//method to execute steps one by one If isStepbystep flag is set as true | |
//It uses to execute array of methods in synchronous manner. | |
function executeNextMethod(methodsArray, methodIndex, callback) { | |
if (methodsArray.length === methodIndex) { |
NewerOlder