我有这段代码:
dojo.declare("dh.medview.Viewport", null, {
someMember: null;
someFunction: function() {
}
});
如何转换此代码以获得纯粹的“JS类”decleration?
答案 0 :(得分:1)
// create namespace
dh = dh || {};
dh.medview = dh.medview || {};
// constructor:
dh.medview.Viewport = function() {
// yours is empty
};
// setup properties of the prototype
var proto = dh.medview.Viewport.prototype;
proto.someMember = null;
proto.someFunction = function() {…};