Last active
August 29, 2015 14:07
-
-
Save ParthBarot-BoTreeConsulting/f9039d96dc4ccccf88ab to your computer and use it in GitHub Desktop.
Create Javascript class using coffe script
This file contains 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
this.Elijah ?= {} | |
class TemperaturesController | |
constructor: (@opts) -> | |
console.log "temps init!" | |
index: -> | |
console.log "temps index!" | |
console.log @opts | |
this.Elijah.temperatures = new TemperaturesController([1,2,3]) | |
this.Elijah.temperatures1 = new TemperaturesController([3,5,6]) | |
this.Elijah.temperatures.index() | |
this.Elijah.temperatures1.index() |
This file contains 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
var TemperaturesController; | |
if (this.Elijah == null) { | |
this.Elijah = {}; | |
} | |
TemperaturesController = (function() { | |
function TemperaturesController(opts) { | |
this.opts = opts; | |
console.log("temps init!"); | |
} | |
TemperaturesController.prototype.index = function() { | |
console.log("temps index!"); | |
return console.log(this.opts); | |
}; | |
return TemperaturesController; | |
})(); | |
this.Elijah.temperatures = new TemperaturesController([1, 2, 3]); | |
this.Elijah.temperatures1 = new TemperaturesController([3, 5, 6]); | |
this.Elijah.temperatures.index(); | |
this.Elijah.temperatures1.index(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment