Skip to content
  • Rigor Colonialis @rigor_colonialis ·

    When running this code in Firefox from the F12 console I get this error Uncaught ReferenceError: can't access lexical declaration 'injectedFunction' before initialization

  • Reporter

    @rigor_colonialis Line 103 references "injectedFunction" inside the scope of initializeCanvas but is set outside that scope in Line 144. In JavaScript, variables declared with let and const are hoisted to the top of their enclosing block, but they cannot be accessed until the execution reaches the line where they are defined. This period from the start of the block until the variable declaration is known as the temporal dead zone. The function initializeCanvas makes a call to injectedFunction. However, initializeCanvas is called (at the end of the code and inside loadState) before injectedFunction is defined. This leads to the reference error because injectedFunction is in the TDZ at the time it's being called. I can fix it if someone gives me access to the code.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment