mirror of
https://github.com/atom/atom.git
synced 2026-02-10 22:55:09 -05:00
Add $.fn.document, which associates event-listeners with descriptions
`$.fn.events` now returns an array of event-name/description pairs.
This commit is contained in:
@@ -38,8 +38,15 @@ $.fn.trueHeight = ->
|
||||
$.fn.trueWidth = ->
|
||||
this[0].getBoundingClientRect().width
|
||||
|
||||
$.fn.document = (eventDescriptions) ->
|
||||
@data('documentation', {}) unless @data('documentation')
|
||||
_.extend(@data('documentation'), eventDescriptions)
|
||||
|
||||
$.fn.events = ->
|
||||
events = _.keys(@data('events') ? {})
|
||||
documentation = @data('documentation') ? {}
|
||||
events = _.keys(@data('events') ? {}).map (eventName) ->
|
||||
_.compact([eventName, documentation[eventName]])
|
||||
|
||||
if @hasParent()
|
||||
events.concat(@parent().events())
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user