提交 1785081e 编写于 作者: 1 100pah

fix: clarify comments.

上级 95e9b271
......@@ -47,11 +47,15 @@ const inner = makeInner<{
class ComponentModel<Opt extends ComponentOption = ComponentOption> extends Model<Opt> {
// [Caution]: for compat the previous "class extend"
// publich and protected fields must be initialized on
// prototype rather than in constructor. Otherwise the
// subclass overrided filed will be overwritten by this
// class. That is, they should not be initialized here.
// [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`,
// the class members must not be initialized in constructor or declaration place.
// Otherwise there is bad case:
// class A {xxx = 1;}
// enableClassExtend(A);
// class B extends A {}
// var C = B.extend({xxx: 5});
// var c = new C();
// console.log(c.xxx); // expect 5 but always 1.
/**
* @readonly
......
......@@ -46,11 +46,15 @@ type Value<Opt, R> = Opt extends Dictionary<any>
class Model<Opt extends ModelOption = ModelOption> { // TODO: TYPE use unkown insteadof any?
// [Caution]: for compat the previous "class extend"
// publich and protected fields must be initialized on
// prototype rather than in constructor. Otherwise the
// subclass overrided filed will be overwritten by this
// class. That is, they should not be initialized here.
// [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`,
// the class members must not be initialized in constructor or declaration place.
// Otherwise there is bad case:
// class A {xxx = 1;}
// enableClassExtend(A);
// class B extends A {}
// var C = B.extend({xxx: 5});
// var c = new C();
// console.log(c.xxx); // expect 5 but always 1.
/**
* @readOnly
......
......@@ -109,11 +109,15 @@ interface SeriesModel {
class SeriesModel<Opt extends SeriesOption = SeriesOption> extends ComponentModel<Opt> {
// [Caution]: for compat the previous "class extend"
// publich and protected fields must be initialized on
// prototype rather than in constructor. Otherwise the
// subclass overrided filed will be overwritten by this
// class. That is, they should not be initialized here.
// [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`,
// the class members must not be initialized in constructor or declaration place.
// Otherwise there is bad case:
// class A {xxx = 1;}
// enableClassExtend(A);
// class B extends A {}
// var C = B.extend({xxx: 5});
// var c = new C();
// console.log(c.xxx); // expect 5 but always 1.
// @readonly
type: string;
......
......@@ -95,11 +95,15 @@ interface ChartView {
}
class ChartView {
// [Caution]: for compat the previous "class extend"
// publich and protected fields must be initialized on
// prototype rather than in constructor. Otherwise the
// subclass overrided filed will be overwritten by this
// class. That is, they should not be initialized here.
// [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`,
// the class members must not be initialized in constructor or declaration place.
// Otherwise there is bad case:
// class A {xxx = 1;}
// enableClassExtend(A);
// class B extends A {}
// var C = B.extend({xxx: 5});
// var c = new C();
// console.log(c.xxx); // expect 5 but always 1.
// @readonly
type: string;
......
......@@ -45,11 +45,15 @@ interface ComponentView {
class ComponentView {
// [Caution]: for compat the previous "class extend"
// publich and protected fields must be initialized on
// prototype rather than in constructor. Otherwise the
// subclass overrided filed will be overwritten by this
// class. That is, they should not be initialized here.
// [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`,
// the class members must not be initialized in constructor or declaration place.
// Otherwise there is bad case:
// class A {xxx = 1;}
// enableClassExtend(A);
// class B extends A {}
// var C = B.extend({xxx: 5});
// var c = new C();
// console.log(c.xxx); // expect 5 but always 1.
readonly group: ViewRootGroup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册