Document Custom Events


#1

Looking through other plugins, its clear that many useful custom events are fired off that we could bind to (if we knew what they were). Are these documented somewhere that I am missing?


#2

I’ve been greping through /Applications/Atom.app/Contents for things.


Change Listener
#3

No, they’re not documented at the moment, but we’re well aware that they’re hella important. :smiley:


#4

Has anyone figured out what the event for ‘save’ is? I’d like for a package to intercept the saving of a file to do some linting etc.


#5

@subscribe buffer, 'saved', =>

That being said I haven’t got far enough to confirm this works, fighting with requiring modules.


Event to tie into buffer loading?
#6

FYI: @buffer.on 'change' works, if @buffer points to a TextBuffer for change events.


#7

Hey,
I had the same problem, so I did a bit of grep/sed/awk magic in atom’s package and ended up with this list: https://gist.github.com/ardcore/9262498


#8

Here are some more examples of useful event bindings


#9

Events I care about that I haven’t found:

renaming/deleting files/dirs not associated with a buffer -
presumably something in pathwatcher or perhaps project.rootDirectory will be helpful- I may monkey patch the later to see what it emits.

Ok, so thats really it…


#10

So…

var original = atom.project.rootDirectory.emit;
atom.project.rootDirectory.emit = function() {
  console.log(arguments);
  original.apply(this, _.toArray(arguments));
};

I see contents-changed and after-contents-changed, but only when I do stuff to a direct child. Iterating through child folders and adding listeners seems wrong…


#11

Atom has been out for a bit of time now, how come all these events and the subscription mechanism is not documented anywhere ? It would boost the package community.


#12

Bump

Writing a plugin right now and would really love to know the available events.