您的位置:首页 > Web前端 > JavaScript

WinJS.Class.define function

2013-02-20 14:45 393 查看
Applies to: Windows Store apps
only

Defines a class using the given constructor and the specified
instance members.


Syntax

var object = WinJS.Class.define(constructor, instanceMembers, staticMembers);



Parameters

constructor

Type: Function

A constructor function that is used to instantiate this type.

instanceMembers

Type: Object

The set of instance fields, properties, and methods made available
on the type.

staticMembers

The set of static fields, properties, and methods made available on
the type.


Return value

Type: Object

The newly-defined type.


Remarks

For more information about using this method,
see Defining
and deriving types with WinJS.Class. For information about
using constructors to define types in JavaScript,
see Using
Constructors to Define Types.


Examples

The following code shows how to use this method.

JavaScript

var Robot = WinJS.Class.define( function(name) {
this.name = name;
},
{ modelName: "" },
{ harmsHumans: false });

var myRobot = new Robot("Mickey");

myRobot.modelName = "4500";
Robot.harmsHumans = false;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: