https://github.com/milojs/ml-mixin
Mixin pattern but ml-mixin is implemented as a separate object that is stored on the property of the host object and can create proxy methods on the host object if required.
https://github.com/milojs/ml-mixin
Last synced: about 1 month ago
JSON representation
Mixin pattern but ml-mixin is implemented as a separate object that is stored on the property of the host object and can create proxy methods on the host object if required.
- Host: GitHub
- URL: https://github.com/milojs/ml-mixin
- Owner: milojs
- License: mit
- Created: 2016-04-24T21:38:12.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-05-24T16:47:40.000Z (almost 9 years ago)
- Last Synced: 2025-08-09T10:58:44.816Z (8 months ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ml-mixin
[](https://travis-ci.org/milojs/ml-mixin)
[](https://badge.fury.io/js/ml-mixin)
[](https://codeclimate.com/github/milojs/ml-mixin)
[](https://codeclimate.com/github/milojs/ml-mixin/coverage)
An abstract Mixin class.
Can be subclassed using:
```
var MyMixin = _.createSubclass(milo.classes.Mixin, 'MyMixin');
```
Mixin pattern is used, but ml-mixin is implemented as a separate object that is stored on the property of the host object and can create proxy methods on the host object if required. This allows more complex behavior as mixin itself can maintain a state separate from the host object.
`this` in proxy methods refers to Mixin instance, the reference to the host object is `this._hostObject`
More docs to come.