jona
jona

Reputation: 399

How to call a function in my package every time code is inserted?

I'm writing an Atom package, and I'd like to know how to get a function that my package exposes and that is accessible via a context menu call to be called every time the user types code into the editor.

Upvotes: 0

Views: 99

Answers (1)

Layon Ferreira
Layon Ferreira

Reputation: 447

Without seeing your code, I can assume that you are after one of thoose callbacks:

onDidChange - is called when the buffer changes(Synchronous) https://atom.io/docs/api/v1.2.4/TextEditor#instance-onDidChange

or ::onDidStopChanging(callback) for heavy tasks - called 300ms after change(Asynchronous) https://atom.io/docs/api/v1.2.4/TextEditor#instance-onDidStopChanging

Upvotes: 1

Related Questions