Merge branch 'lmlayer-init' into lmlayer-sans-import-scripts

This commit is contained in:
Eddie Antonio Santos 2018-11-19 19:58:35 -07:00
commit 17dfd2d76e
No known key found for this signature in database
GPG key ID: DD411EA4D9509D87

View file

@ -197,8 +197,20 @@ class LMLayerWorker {
}
/**
* Creates a new instance of the LMLayerWorker, and installs
* all its functions within the provided Worker scope.
* Creates a new instance of the LMLayerWorker, and installs all its
* functions within the provided Worker global scope.
*
* In production, this is called within the Worker's scope as:
*
* LMLayerWorker.install(self);
*
* ...and this will setup onmessage and postMessage() appropriately.
*
* During testing, this method is useful to mock an entire global scope,
*
* var fakeScope = { postMessage: ... };
* LMLayerWorker.install(fakeScope);
* // now we can spy on methods in fakeScope!
*
* @param scope A global scope to install upon.
*/