https://github.com/jamiemason/subclass.js
Inherit, extend, decorate, and override classes and instances.
https://github.com/jamiemason/subclass.js
Last synced: about 1 month ago
JSON representation
Inherit, extend, decorate, and override classes and instances.
- Host: GitHub
- URL: https://github.com/jamiemason/subclass.js
- Owner: JamieMason
- License: other
- Created: 2014-02-02T15:41:01.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-11-02T03:33:18.000Z (over 5 years ago)
- Last Synced: 2025-04-24T03:12:01.856Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/subclass
- Size: 19.5 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# subclass.js
> A small and simple way to inherit, extend, decorate, and override JavaScript classes and instances in an efficient and convenient manner.
## Small Size
349 bytes (minified and gzipped).
## Simple API
Subclass `Extendable` to create your first class.
```javascript
var Car = Extendable.extend(function(options) {
// ... constructor
}).shared({
// ... prototype members
}).statics({
// ... static members
});
```Which itself can be subclassed.
```javascript
var Audi = Car.extend( /* ... */ );
var Toyota = Car.extend( /* ... */ );
```And whose subclasses can also be subclassed.
```javascript
var AudiHatchback = Audi.extend( /* ... */ );
var ToyotaHatchback = Toyota.extend( /* ... */ );
```