Open kazuho opened 11 years ago
Sorry to change my words but it is impossible to extend a JSX class using ordinary JavaScript (see the example in prev. comment; the method say
belonging to an instance is sometimes known to be __export__
ed and sometimes not). We need to provide a helper function.
The helper function for extending JSX classes in JavaScript may look like follows:
var Base = JSX.require("foo.jsx");
var Derived = Base.$extend({
constructor: function () {
...
},
toString: function () {
...
},
});
+1 for helper function
As @shibukawa suggested, exported classes should be extendable by using ordinary JavaScript.
note: the example right below is known not to work, for the current proposal see https://github.com/jsx/JSX/issues/153#issuecomment-17391593