Node.js

Singleton Pattern with JavaScript

Many a times, we face a requirement where we need only one object of a class to communicate across the application. Singleton Pattern comes into role in this scenario. Singleton is one of my favorite Design Patterns. Singleton pattern restricts us to initialize more than one object. We implement Singleton by creating a class, having a...

by Amit Kumar
Tag: javascript
14-Feb-2014

Technology

JavaScript’s return statement gotcha

Hi everyone, This blog is about how JavaScript parses your script (source code) when it encounters return statement. We can write code using any one style of following two: Style 1: [sourcecode language="java"] function func() { return 6; } [/sourcecode] and Style 2: [sourcecode language="java"] function func() ...

by Manvendra Pratap Singh
Tag: javascript
11-Feb-2014

Node.js

Getting Started with Grunt:Task Runner

I was working on one of my projects which involved multiple task execution on regular basis. Well, I think that many of us have faced similar issues on their projects which increases our work and making it more time-consuming and increased work. Working in a community where people are actively developing tools to automate tedious...

by Sahil Chitkara
Tag: javascript
06-Feb-2014

Node.js

Equality(==) vs Identity(===)

In JavaScript, we have Equality (==) and Identity(===) operators for equality comparison between two values/operands. When first time we see Equality (==) and Identity (===) operators, then following questions arise in our mind. 1. What is difference between Equality (==) and Identity (===) ? 2. Is there a performance benefit with...

by Amit Kumar
Tag: javascript
05-Feb-2014

Node.js

Scope In JavaScript

Many a times we get confused with scope in JavaScript, So here I am going to put some light on scope. There are two types of scope in JavaScript. First one is, function scope which is also called as local scope, and second one is global scope. Function Scope: In JavaScript, variables are defined with function scope instead of block...

by Amit Kumar
Tag: javascript
04-Feb-2014

Node.js

Writable Streams In Node.Js

In my previous blog we discussed about “Readable Streams in Node.js”. Here we will be learning about the next part of stream which is, writable stream. Writable stream is used to write data to a specific destination. Basically its has two main method : write. end Write: ...

by Sahil Chitkara
Tag: javascript
30-Jan-2014

Technology

Event Emitters In Node.JS

Event Emitters are used to create and manage our own events and trigger them accordingly. We can bind listeners and emit those events whenever required. Example : [js] var events = require('events'); var eventEmitter = new events.EventEmitter(); eventEmitter.on('Morning', function welcomeMessage() { console.log('Good...

by Sakshi Tyagi
Tag: javascript
03-Jan-2014

Node.js

Protecting Objects In JavaScript

JavaScript is an amazing language. Its like a Lego constructor, depending on different parts you join together, you may get the script you need or just a pile of unwanted codes. Information hiding gets very important when you want to give access to only minimal interface of a module. Depending on the level of protection, this blog...

by Sahil Chitkara
Tag: javascript
19-Sep-2013

Technology

Handlebars: An Introduction

Let's face it, gone are the days where static HTML markup was sufficient, and clients were happy with animated gifs all around their websites, but that's all a thing of the past. Now every little thing you can think of has to be dynamic, the data is constantly changing and so is the webpage. For developers it is a tricky task to manage...

by Manoj Nama
Tag: javascript
08-Sep-2013

Technology

jQuery: Unbinding specific event with namespace

If we follow the normal jQuery practices for binding and unbinding multiple jQuery events, it involves writing code again and again for each of the binding and unbinding which makes it very repetitive, specially when unbinding. Joint unbinding is also seen when you have same event bound to the same DOM element multiple times. Lets...

by Shreyance Jain
Tag: javascript
27-Aug-2013

Technology

How to Use CRAWLME

How to implement CRAWLME? Make you ajax app use the hashbang #! instead of just hash # in urls which allows Google to crawl and index those ajax supported urls. Insert the CRAWLME middleware before your server in the chain of Connect/Express middlewares. Crawlme takes care of rest. Example: var connect = require('connect'); ...

by Shreyance Jain
Tag: javascript
12-Aug-2013

Technology

MAKE your AJAX WEB APPLICATION INDEXABLE using CRAWLME

Recently, Programmers are more inclined towards creating web application with AJAX than doing it with static HTML pages which makes applications faster and richer. But by doing so, application loses its indexability which results in modern and user friendly yet less searchable apps. Let’s take an example of a website:  For browser/user...

by Shreyance Jain
Tag: javascript
12-Aug-2013