Created
May 10, 2016 09:34
-
-
Save mralexgray/3c92d77878261b3c35c9f4afb03c8065 to your computer and use it in GitHub Desktop.
Simple coffee-script class definition, module export, and example usage.
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
| r = require 'events' | |
| class Hello extends r | |
| greet: () -> | |
| console.log 'hello' | |
| @emit 'greeted' | |
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
| e = require './exported' | |
| hello = new Hello | |
| hello.on 'greeted', -> console.log 'jice to meet' | |
| hello.greet() | |
| # require("#{__dirname}/hello") | |
| # hello = new Hello() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment