Skip to content

Commit 7fd684f

Browse files
committed
* Clarify global scope
1 parent 5f95d66 commit 7fd684f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

spreadsheet/chapter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ There are three reasons for using a Web Worker to calculate formulas, instead of
329329
330330
* While the worker runs in the background, the user is free to continue interacting with the spreadsheet, without getting blocked by computation in the main thread.
331331
* Because we accept any JS expression in a formula, the worker provides a _sandbox_ that prevents formulas from interfering with the page that contains it, such as by popping out an `alert()` dialog.
332-
* A formula can refer to any coordinates as variables, which may contain yet another formula that possibly ends in a cyclic reference. To solve this problem, we use the Worker’s _global scope_ self, and define these variables as _getter functions_ on its properties.
332+
* A formula can refer to any coordinates as variables, which may contain yet another formula that possibly ends in a cyclic reference. To solve this problem, we use the Worker’s _global scope_ object `self`, and define these variables as _getter functions_ on `self` that contains the logic to mitigate cyclic references.
333333
334334
With these in mind, let’s take a look at the worker’s code. Because **index.html** pre-loads the worker program with a `<script>` tag, in **worker.js** we first ensure that we’re actually running as a background task:
335335

0 commit comments

Comments
 (0)