Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Mar 24, 2020
1 parent 7072ce6 commit 6db2cf1
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ type Thenable = {
// replicate it in user space. null means that it has already loaded.
const chunkCache: Map<string, null | Thenable | Error> = new Map();

// Returning null means that all dependencies are fulfilled and we
// can synchronously require the module now. A thenable is returned
// that when resolved, means we can try again.
// Start preloading the modules since we might need them soon.
// This function doesn't suspend.
export function preloadModule<T>(moduleData: ModuleReference<T>): void {
let chunks = moduleData.chunks;
for (let i = 0; i < chunks.length; i++) {
Expand All @@ -51,6 +50,8 @@ export function preloadModule<T>(moduleData: ModuleReference<T>): void {
}
}

// Actually require the module or suspend if it's not yet ready.
// Increase priority if necessary.
export function requireModule<T>(moduleData: ModuleReference<T>): T {
let chunks = moduleData.chunks;
for (let i = 0; i < chunks.length; i++) {
Expand Down

0 comments on commit 6db2cf1

Please sign in to comment.