Skip to content

Commit

Permalink
Modernize JS usage in library_pthread.js. NFC (#22545)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 authored Sep 9, 2024
1 parent fde086d commit 8800faa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/library_pthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var LibraryPThread = {
) {
t = _pthread_self();
}
return 'w:' + workerID + ',t:' + ptrToString(t) + ': ';
return `w:${workerID},t:${ptrToString(t)}: `;
}

// Prefix all err()/dbg() messages with the calling thread ID.
Expand Down Expand Up @@ -411,7 +411,7 @@ var LibraryPThread = {
#if EXPORT_ES6 && USE_ES6_IMPORT_META
// If we're using module output, use bundler-friendly pattern.
#if PTHREADS_DEBUG
dbg('Allocating a new web worker from ' + import.meta.url);
dbg(`Allocating a new web worker from ${import.meta.url}`);
#endif
#if TRUSTED_TYPES
// Use Trusted Types compatible wrappers.
Expand Down Expand Up @@ -723,10 +723,10 @@ var LibraryPThread = {
#endif
var offscreenCanvases = {}; // Dictionary of OffscreenCanvas objects we'll transfer to the created thread to own
var moduleCanvasId = Module['canvas'] ? Module['canvas'].id : '';
var moduleCanvasId = Module['canvas']?.id || '';
// Note that transferredCanvasNames might be null (so we cannot do a for-of loop).
for (var i in transferredCanvasNames) {
var name = transferredCanvasNames[i].trim();
for (var name of transferredCanvasNames) {
name = name.trim();
var offscreenCanvasInfo;
try {
if (name == '#canvas') {
Expand Down Expand Up @@ -758,7 +758,7 @@ var LibraryPThread = {
}
if (canvas.transferControlToOffscreen) {
#if GL_DEBUG
dbg('pthread_create: canvas.transferControlToOffscreen(), transferring canvas by name "' + name + '" (DOM id="' + canvas.id + '") from main thread to pthread');
dbg(`pthread_create: canvas.transferControlToOffscreen(), transferring canvas by name "${name}" (DOM id="${canvas.id}") from main thread to pthread`);
#endif
// Create a shared information block in heap so that we can control
// the canvas size from any thread.
Expand Down

0 comments on commit 8800faa

Please sign in to comment.