Sha256: 60d3305e1306a569c22668ceebe6bb6a2a4c1253082da5d8f96c81dc57747b49
Contents?: true
Size: 848 Bytes
Versions: 7
Compression:
Stored size: 848 Bytes
Contents
require "jsduck/util/singleton" module JsDuck module Js # Auto-detection of listeners. class Listener include Util::Singleton # Checks if AST node is a listener, and if so, returns doc-hash # with listener name and various auto-detected properties. # When not an listener returns nil. # Note: currently this is not implemented. Needs to check for methods under the "listeners:" item def detect(ast) exp = ast.expression_statement? ? ast["expression"] : nil # this.fireEvent("foo", ...) if exp && 1==2 make(exp["arguments"][0].to_value) else nil end end # Produces a doc-hash for an listener. def make(name) return { :tagname => :listener, :name => name, } end end end end
Version data entries
7 entries across 7 versions & 1 rubygems