Expanding from dashing class

163 Views Asked by At

I am fiddling around with Dashing until I found that it only has one dashboard-level action. [link]

The Dashing project does not have the dashing.coffee file in the directory but it links to it. The reload action is contained here.

class window.Dashing extends Batman.App
  @on 'reload', (data) ->
    window.location.reload(true)

  @root ->
Dashing.params = Batman.URI.paramsFromQuery(window.location.search.slice(1));

I want to expand this file to add more actions. I tried creating a JS file dashing-cus.coffee on my local dashboard in an attempt to build more actions. However, my attempts results to either prototype errors or non-responding actions.

What is the best way to expand its actions? Let's say an 'alert' action to alert 'hello!'

1

There are 1 best solutions below

0
On

I'm not sure why and if you really want to rewrite Dashing class.

But the best way to do it is using just a copy of dashing.coffee inside your project as ./assets/javascript/dashing-cus.coffee and replacing that line for:

 #= require dashing-cus.coffee

On dashing-cus.coffee you can customize window.Dashing as you want, because the original Dashing script will not be used anymore...