Last active
February 16, 2016 19:58
-
-
Save vendethiel/5087bbd98814e2eaff9b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# models | |
class Models | |
constructor: (@db) -> | |
channel: (name) -> new Channel(@db, name) | |
# channel | |
class Channel | |
constructor: (@db) -> | |
foo: -> @db.query '...' | |
# osu plugin | |
class Plugins.Osu | |
constructor: (@models) -> | |
onReceiveMessage: (name) -> | |
channel = @models.channel name | |
channel.foo() | |
# init code | |
redis.connect params, (db) -> | |
models = new Models(db) | |
plugins = for key in 'a b c d'.split(' ') # just as an example | |
plugin = require "./#{key}" | |
new plugin(models) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment