Commit 5a0eff86 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

Remove addPageLoadHandler use from file manager main.js

Call DOMContentLoaded directly. Update comments.

Bug: 887792
Change-Id: Ib688e8dda1b74ff065e91a980099050ca19cb8a4
Reviewed-on: https://chromium-review.googlesource.com/1237018Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593068}
parent fe6e02d2
...@@ -9,16 +9,17 @@ var fileManager; ...@@ -9,16 +9,17 @@ var fileManager;
/** /**
* Indicates if the DOM and scripts have been already loaded. * Indicates if the DOM and scripts have been already loaded.
* TODO(noel): is this variable used anywhere?
* @type {boolean} * @type {boolean}
*/ */
var pageLoaded = false; var pageLoaded = false;
/** /**
* Kick off the file manager dialog. * Initializes the File Manager UI and starts the File Manager dialog. Called
* Called by main.html after the DOM has been parsed. * by main.html after the DOM and all scripts have been loaded.
* @param event DOMContentLoaded event.
*/ */
function init() { function init(event) {
// Initializes UI and starts the File Manager dialog.
fileManager.initializeUI(document.body).then(function() { fileManager.initializeUI(document.body).then(function() {
util.testSendMessage('ready'); util.testSendMessage('ready');
metrics.recordInterval('Load.Total'); metrics.recordInterval('Load.Total');
...@@ -26,15 +27,15 @@ function init() { ...@@ -26,15 +27,15 @@ function init() {
}); });
} }
// Create the File Manager object. Note, that the DOM, nor any external // Creates the File Manager object. Note that the DOM, or any external
// scripts may not be ready yet. // scripts, may not be ready yet.
fileManager = new FileManager(); fileManager = new FileManager();
// Initialize the core stuff, which doesn't require access to DOM nor to // Initialize the core stuff, which doesn't require access to the DOM or
// additional scripts. // to external scripts.
fileManager.initializeCore(); fileManager.initializeCore();
// Final initialization is performed after all scripts and DOM is loaded. // Final initialization performed after DOM and all scripts have loaded.
util.addPageLoadHandler(init); document.addEventListener('DOMContentLoaded', init);
metrics.recordInterval('Load.Script'); // Must be the last line. metrics.recordInterval('Load.Script'); // Must be the last line.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment