Skip to content

Commit fa5d8d7

Browse files
committed
Integrate getName changes from @bielfrontera
See Shopify#310
1 parent 3bca71e commit fa5d8d7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

javascripts/dashing.coffee

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Dashing.params = Batman.URI.paramsFromQuery(window.location.search.slice(1));
3434
class Dashing.Widget extends Batman.View
3535
constructor: ->
3636
# Set the view path
37-
@constructor::source = Batman.Filters.underscore(@constructor.name)
37+
@constructor::source = Batman.Filters.underscore(getName())
3838
super
3939

4040
@mixin($(@node).data())
@@ -62,6 +62,11 @@ class Dashing.Widget extends Batman.View
6262
onData: (data) =>
6363
# Widgets override this to handle incoming data
6464

65+
getName: () =>
66+
funcNameRegex = /function ([^\(]{1,})\(/;
67+
results = (funcNameRegex).exec(@constructor.toString())
68+
if (results && results.length > 1) then results[1].trim() else ""
69+
6570
Dashing.AnimatedValue =
6671
get: Batman.Property.defaultAccessor.get
6772
set: (k, to) ->

0 commit comments

Comments
 (0)