-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Refactor global brackets ready and htmlContentLoadComplete events to a new Global module #1425
Conversation
…. Update comments in Global module.
Yes. Those unit tests broke after the refactoring. |
// a handler for the brackets 'ready' and 'htmlContentLoadComplete' events | ||
global.brackets.ready = ready; | ||
global.brackets.htmlContentLoadComplete = htmlContentLoadComplete; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if adding these handlers to global.brackets is dangerous. It means that people could write code that registers handlers without actually loading this module. That allows the race condition we're trying to avoid with this refactoring.
Given that this module will be loaded asynchronously by require, I think it's certainly the case that if there was a not-using-require script include that immediately accessed brackets.ready, it would not yet be defined.
@jason-sanjose initial review done -- lookin' good. Back at ya! Happy to chat over IRC if that's easier. |
… race conditions with the global brackets property.
@@ -341,7 +257,11 @@ define(function (require, exports, module) { | |||
var initialProjectPath = ProjectManager.getInitialProjectPath(); | |||
ProjectManager.openProject(initialProjectPath).done(function () { | |||
_initTest(); | |||
_initExtensions().always(_onBracketsReady); | |||
|
|||
// WARNING: brackets.ready won't fire if ANY extension fails to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't called brackets.ready anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the following comment needs to be cleaned up: line 61 of src/index.html
…s/Global. Add require("utils/Global") for any occurrences. Fix comments.
|
Refactor global brackets ready and htmlContentLoadComplete events to a new Global module
utils/Global
module that initializes the globalbrackets
namespacebrackets
init code