How to Create a Class in Javascript in WinJS ?

You can define a new class using WinJS.class.define when developing Windows Store App using Javascript.

How to Create a Class in Javascript in WinJS ?

The WinJS.Class.define method can be used to create a new class in WinJS  . It accepts 3 parameters

– Constructor

– instanceMembers

– staticMembers

Below is a sample code snippet demonstrating the usage WinJS.Class.define to create a new class in WinJS

var abundantcode = WinJS.Class.define(
function(a,b)
{
this.a = a;
this.b = b;
},
{
    a: undefined,
    b: 10,
    _b: {
        set: function (value) {
            this.b = value;
        }
    }
}
);

Leave Your Comment

Liked this content?. Please spread the word :)