Method: JsDuck::Accessors#create_event

Defined in:
lib/jsduck/accessors.rb

#create_event(cfg) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/jsduck/accessors.rb', line 80

def create_event(cfg)
  name = cfg[:name].downcase + "change"
  setter_name = "set" + upcase_first(cfg[:name]);
  return add_shared({
    :tagname => :event,
    :name => name,
    :doc => "Fires when the {@link ##{cfg[:id]}} configuration is changed by {@link #method-#{setter_name}}.",
    :params => [
      {
        :name => "this",
        :type => cfg[:owner],
        :doc => "The #{cfg[:owner]} instance."
      },
      {
        :name => "value",
        :type => cfg[:type],
        :doc => "The new value being set."
      },
      {
        :name => "oldValue",
        :type => cfg[:type],
        :doc => "The existing value."
      },
    ],
    :id => "event-" + name,
  }, cfg)
end