Loading lib/jsduck/js/ast.rb +10 −0 Original line number Diff line number Diff line require "jsduck/js/function" require "jsduck/js/fires" require "jsduck/js/node" require "jsduck/tag_registry" Loading Loading @@ -316,6 +317,7 @@ module JsDuck :name => name, :params => empty_array_to_nil(make_params(ast)), :chainable => chainable?(ast) && name != "constructor", :fires => empty_array_to_nil(detect_fires(ast)), } end Loading @@ -339,6 +341,14 @@ module JsDuck end end def detect_fires(ast) if ast.function? && !ast.ext_empty_fn? Js::Fires.detect(ast).map {|e| {:name => e} } else [] end end def make_event(name) return { :tagname => :event, Loading lib/jsduck/tag/method.rb +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ module JsDuck::Tag h = super(code) h[:params] = code[:params] h[:chainable] = code[:chainable] h[:fires] = code[:fires] h end Loading spec/aggregator_fires_spec.rb +15 −0 Original line number Diff line number Diff line Loading @@ -70,4 +70,19 @@ describe JsDuck::Aggregator do end end describe "this.fireEvent() in code" do before do @fires = parse_fires(<<-EOS) /** */ function bar() { this.fireEvent("click"); } EOS end it "detects event from code" do @fires[0].should == "click" end end end Loading
lib/jsduck/js/ast.rb +10 −0 Original line number Diff line number Diff line require "jsduck/js/function" require "jsduck/js/fires" require "jsduck/js/node" require "jsduck/tag_registry" Loading Loading @@ -316,6 +317,7 @@ module JsDuck :name => name, :params => empty_array_to_nil(make_params(ast)), :chainable => chainable?(ast) && name != "constructor", :fires => empty_array_to_nil(detect_fires(ast)), } end Loading @@ -339,6 +341,14 @@ module JsDuck end end def detect_fires(ast) if ast.function? && !ast.ext_empty_fn? Js::Fires.detect(ast).map {|e| {:name => e} } else [] end end def make_event(name) return { :tagname => :event, Loading
lib/jsduck/tag/method.rb +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ module JsDuck::Tag h = super(code) h[:params] = code[:params] h[:chainable] = code[:chainable] h[:fires] = code[:fires] h end Loading
spec/aggregator_fires_spec.rb +15 −0 Original line number Diff line number Diff line Loading @@ -70,4 +70,19 @@ describe JsDuck::Aggregator do end end describe "this.fireEvent() in code" do before do @fires = parse_fires(<<-EOS) /** */ function bar() { this.fireEvent("click"); } EOS end it "detects event from code" do @fires[0].should == "click" end end end