How to always return a default value for an object property in javascript?

Standard

Hi Guys,

Do you have a need where you want to return something as a default value if your JS object don’t have that property?

Let’s come to our problem.

Lets take an object (kind of a key value configuration object) which is coming from server and we need to make some very important decision based on this data.

var electricalConfig = {
  isLightOn: true,
  isBoardSmart: false,
  noOfSwitch: 10,
  noOfSockets: 3,
  isConnected: true
};

Continue reading

Web apps with no internet :) Beginner’s Guide for application cache

Standard

Hello Guys,

In this modern world, website are essentials. Have you wondered what if you have to read some article or use some web application while you are moving in train or bus and you have no internet? What if you provide this feature to your user? Answer is : This will be a great user experience to them.

What if your user doesn’t have to download your website content each time they visit? Don’t you think this experience will be much far faster than before? Again answer is YES in capital letters.

Let’s see approach.

Continue reading

How to get selected text from textarea/text input in Ext JS

Standard

Hi Guys!

Here I am going to explain about getting selected text string from a EXTJS/HTML textarea/textinput.

We need to write two different code for IE based browsers and rest of all.

In ExtJS first we need to select dom element of textarea and that can be done using inputEl.dom.

Continue reading