James Coglan没有久前更新了JS.Class,公布了 JS.Class 2.1版本,应用JavaScript完成了Ruby的工具零碎。
var Event = new JS.Class({
include: JS.Observable,
fire: function(data) {
this.notifyObservers('fire', data);
}
});
JS.Class is designed to make JavaScript behave like Ruby in terms of its OOP structures. To this end, it provides the following features:
Classes and modules with Ruby-compatible inheritance
Subclassing and mixins
Late-binding arguments-optional super calls to parent classes and mixins
Singleton methods and eigenclasses
included, extended and inherited hooks
Method binding
Ports of various standard Ruby modules, including Enumerable, Hash, Set, Observable, Comparable, Forwardable
Its inheritance system supports late-bound super() calls to parent classes and modules, including calls from singleton methods. It has been designed to mimick Ruby as closely as possible, so if you know Ruby you should feel right at home.
var Event = new JS.Class({
include: JS.Observable,
fire: function(data) {
this.notifyObservers('fire', data);
}
});
JS.Class is designed to make JavaScript behave like Ruby in terms of its OOP structures. To this end, it provides the following features:
Classes and modules with Ruby-compatible inheritance
Subclassing and mixins
Late-binding arguments-optional super calls to parent classes and mixins
Singleton methods and eigenclasses
included, extended and inherited hooks
Method binding
Ports of various standard Ruby modules, including Enumerable, Hash, Set, Observable, Comparable, Forwardable
Its inheritance system supports late-bound super() calls to parent classes and modules, including calls from singleton methods. It has been designed to mimick Ruby as closely as possible, so if you know Ruby you should feel right at home.
版权声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。