Lets say I have 5 Fusion Charts Most of the charts have same attributes. I have to pass all this attributes into coffeescript contructor But how to achieve it?
any sample code would be helpful
Below is a example class declaration that take a parameter and when we call draw
method it print input params
on console.
class Chart
constructor: (params) ->
# initialize your variable
# example @foo = params
@attr = params
draw: ->
# access @attr instance variable
console.log "your input params is #{@attr}"
new Chart('this is test params').draw()
I highly recommended you first read coffeescript official guide before start. There are great books available that may help you The Little Book on CoffeeScript and coffeescript-cookbook . And of-course use http://js2.coffee/ site for experiment js to coffee and vise versa . Hope it will help you
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.