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;
/**
* Indicates if the DOM and scripts have been already loaded.
* TODO(noel): is this variable used anywhere?
* @type {boolean}
*/
var pageLoaded = false;
/**
* Kick off the file manager dialog.
* Called by main.html after the DOM has been parsed.
* Initializes the File Manager UI and starts the File Manager dialog. Called
* by main.html after the DOM and all scripts have been loaded.
* @param event DOMContentLoaded event.
*/
function init() {
// Initializes UI and starts the File Manager dialog.
function init(event) {
fileManager.initializeUI(document.body).then(function() {
util.testSendMessage('ready');
metrics.recordInterval('Load.Total');
......@@ -26,15 +27,15 @@ function init() {
});
}
// Create the File Manager object. Note, that the DOM, nor any external
// scripts may not be ready yet.
// Creates the File Manager object. Note that the DOM, or any external
// scripts, may not be ready yet.
fileManager = new FileManager();
// Initialize the core stuff, which doesn't require access to DOM nor to
// additional scripts.
// Initialize the core stuff, which doesn't require access to the DOM or
// to external scripts.
fileManager.initializeCore();
// Final initialization is performed after all scripts and DOM is loaded.
util.addPageLoadHandler(init);
// Final initialization performed after DOM and all scripts have loaded.
document.addEventListener('DOMContentLoaded', init);
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