add current and previous documents to currentDocumentChange event#7509
add current and previous documents to currentDocumentChange event#7509peterflynn merged 2 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Why don't you use an associative array?
I'd take {current: _currentDocument, previous: previousDocument}
There was a problem hiding this comment.
triggerHandler gets arguments in an array and then spreads them to the callback like this:
https://github.com/zaggino/brackets-git/blob/43d62647ca8d8747f1cc649019f08bc451440fcf/src/BracketsEvents.js#L51-L56
|
+1 for this. I actually wish every Change event we have provided a newState and an oldState. Would save on maintaining cached states. |
|
@zaggino This looks good -- but please just update the docs at the top of the module to indicate the new 2nd & 3rd args. |
|
@peterflynn done |
src/document/DocumentManager.js
Outdated
There was a problem hiding this comment.
Should be the second and third arguments, since the first is always the event itself.
There was a problem hiding this comment.
Yes, sry. Early morning here :) Fixed
|
Looks good now -- thanks! |
Add current and previous document args to currentDocumentChange event
Useful nit to avoid calling
DocumentManager.getCurrentDocument()everytime when hooked on the event and also the only way to know what was the previous document I think.