-
Notifications
You must be signed in to change notification settings - Fork 7.6k
LiveDevelopment code cleanup #1340
Comments
@jdiehl or @joelrbrandt I think most of these are minor fix-ups except for the event handling. Can you guys recall the rationale there? |
Inspector.js has its own event handling, because I wasn't sure that jQuery was the way to go in Brackets. The differences you mentioned can be fixed as following:
I see three additional issues:
|
To address the open-should-return-a-promise issue, the live development startup process should be improved (this will also help later when supporting different debuggers): Call LiveDevelopment.open to initiate a live connection
This way the open method can be defined in a single function of LiveDevelopment, which returns a promise that resolves when the promises of all other components (DebuggerDiscovery and Inspector) are resolved. |
can be removed (_onLoad is triggered after loading the agents, not from the Inspector). |
"jQuery can only send events with a single parameter: if multiple parameters are passed, they must be wrapped in an object and the event handling code must be adapted" (@jdiehl) This single parameter can however be an array which gets unwrapped when calling the event handler:
|
"jQuery uses a special naming scheme 'event.nameSpace', which is in conflict with Inspector's naming scheme 'domain.event': the only solution I can see (which I don't like) is to replace the . in inspector events with another character (e.g., -). This would required updating all event handling and emitting code as well as the documentation." (@jdiehl) How about |
Reviewed. |
@jdiehl @DennisKehrig would either of you like to volunteer? If not, I'll take the assignment for next sprint. |
Thanks, but I'll pass on this one! |
@jason-sanjose: @jdiehl is on vacation, so he's unlikely to volunteer, too. :-) @DennisKehrig: thanks for your help! |
No worries. I'll get it. Thanks for the fast response. |
My pleasure! |
Is this still open? Can I help with anything? |
Yep. I targeted it for this sprint. I'll defer to you if you'd like to take a first pass at it. |
I should be able to work on this, tomorrow. Is the consensus to migrate to jQuery events? The remainder seems obvious enough. |
Yep, sounds like a plan. I'll change the assignee. Thanks, Jonathan. |
Confirmed. Closing. |
I hit a few minor issues when fixing the LiveDevelopment unit tests to work in brackets-shell:
on()
andoff()
event handler management instead of using jQuery. The significant differences are that all handlers are triggered async andtrigger()
is made public and accessed by Agents.LiveDevelopment.open()
should return a promise. Currently inLiveDevelopment-test
, we have to pollLiveDevelopment
until the relevantDocClass
(related documents for the current live session) is loaded. Ideallyopen()
would return a promise that resolves when this process is complete.LiveDevelopment
installs aload
event handler onInspector
which does not define aload
eventThe text was updated successfully, but these errors were encountered: