Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryanve/modder
JavaScript: mod your modules
https://github.com/ryanve/modder
coupling hooks javascript modularity
Last synced: about 1 month ago
JSON representation
JavaScript: mod your modules
- Host: GitHub
- URL: https://github.com/ryanve/modder
- Owner: ryanve
- License: mit
- Created: 2015-02-21T10:00:56.000Z (over 9 years ago)
- Default Branch: gh-pages
- Last Pushed: 2017-02-18T05:48:37.000Z (over 7 years ago)
- Last Synced: 2024-09-21T06:24:35.809Z (about 2 months ago)
- Topics: coupling, hooks, javascript, modularity
- Language: JavaScript
- Homepage: http://ryanve.dev/modder/
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# modder
modder is get/set interface for sharing functions and hooking custom behavior into JavaScript modules that provide hooks to do so. It lets you define an interface without implementing all the behavior at once or at all.```
npm install modder --save
```## API
### `modder(name?, value?)`
- `modder(name)` get
- `modder(name, value)` set#### example
```js
// define some API and provide a hook for overloading
var api = {
riot: function(size) {
if (size > 1000) require('modder')('evacuate').call(this)
else this.chill()
}
chill: function() {
}
}// implement behavior later
var modder = require('modder')
modder('evacuate', function() {
// follow evacuation procedure
})
```#### instances
If you need multiple `modder` instances:
```js
var modder1 = modder()
var modder2 = modder()
```## License
MIT