Closed Bug 1316121 Opened 8 years ago Closed 8 years ago

Error in documentation

Categories

(Developer Documentation Graveyard :: API: Web Workers, defect, P1)

All
Other
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: antonnorengustafsson, Unassigned)

References

()

Details

:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

Expected: 

self.postMessage = function (event) {
  if (event.data === "Hello") {
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "myFile.txt", false);  // synchronous request
    xhr.send(null);
    self.postMessage(xhr.responseText);
  }
};

Found: 

self.onmessage = function (event) {
  if (event.data === "Hello") {
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "myFile.txt", false);  // synchronous request
    xhr.send(null);
    self.postMessage(xhr.responseText);
  }
};
it should be "onmessage".
it's a callback function called when the worker receives a message.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.