Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deebloo/mie
and experiment in creating objects
https://github.com/deebloo/mie
Last synced: 15 days ago
JSON representation
and experiment in creating objects
- Host: GitHub
- URL: https://github.com/deebloo/mie
- Owner: deebloo
- Created: 2015-06-06T19:14:08.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T05:35:18.000Z (about 1 year ago)
- Last Synced: 2024-10-31T16:59:37.410Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mie
An experiment with creating objects
```JS
var person = mie.factory('person').extend({
walk: function() {
console.log('walk');
},
talk: function() {
console.log('talk');
}
});var stealthy = mie.factory('stealthy').extend({
sneak: function() {
console.log('sneak');
}
});var solider = mie.factory('solider').is('person').extend({
march: function() {
console.log('march');
},
shoot: function() {
console.log('shoot');
}
});var sniper = mie.factory('sniper').is('solider', 'stealthy').extend({
shoot: function() {
console.log('snipe!');
}
});var danny = person.create('danny', {
fname: 'Danny',
lname: 'Blue'
});var aaron = solider.create('aaron', {
fname: 'Aaron',
lname: 'Druck'
});var cody = sniper.create('cody', {
fname: 'Cody',
lname: 'Henthorne'
});person.list(); // {danny: {...}, aaron: {...}, cody: {...}}
soldier.list(); // {aaron: {...}, cody: {...}}
sniper.list(); // {cody: {...}}mie.factory('person').get('cody') // returns cody
mie.factory('soldier').get('danny') // returns undefined```