The Decorator Design Pattern in JavaScript PRO

The decorator design pattern was created in order to allow us adding new functionality to an already existing class without extending it. The decorator design pattern was created for those cases in which we cannot extend the class. The following code sample shows a simple demo for implementing the decorator design pattern in JavaScript. <!DOCTYPE […]

The Factory Design Pattern in JavaScript PRO

The factory design pattern is a creational pattern. It assists us with creating new objects. Instead of using the new operator in order to create a new object we call the factory method and pass over arguments it uses to create the exact object we need. The following code is a small sample for implementing […]

The PhoneGap window.device Object PRO

The PhoneGap JavaScript library adds new properties to the window global object. One of them is the device property. The device property holds a reference for an object that describes the device. The following code sample shows how simple it is to use this object in order to get detailed information about the device. <!DOCTYPE html> <html> […]

The PhoneGap deviceready Event PRO

When using the PhoneGap JavaScript library we must make sure the device is ready before we start calling the various PhoneGap functions. In order to verify the device is ready we should hook up with the ‘deviceready’ event. The following code sample shows how simple it is to hook up with this event. If you […]

Skip to content Update cookies preferences