クラスとサブクラスを定義するプロトタイプの方法を多用しています。
// properties are directly passed to `create` method
var Person = Class.create({
initialize: function(name) {
this.name = name;
},
say: function(message) {
return this.name + ': ' + message;
}
});
// when subclassing, specify the class you want to inherit from
var Pirate = Class.create(Person, {
// redefine the speak method
say: function($super, message) {
return $super(message) + ', yarr!';
}
});
var john = new Pirate('Long John');
john.say('ahoy matey');
私は 2.3.8 Rails アプリで作業しており、Highcharts (チャート JS ライブラリ) を使用する予定です。私の問題は、Highcharts が jQuery (または MooTools) に依存していることです。
プロトタイプ スタイルで定義されたクラスとサブクラスを jQuery 形式に変更する方法はありますか? または、既存のクラスをプレーンな JavaScript に変更する必要がありますか? ご協力いただきありがとうございます!