Skip to content

Commit

Permalink
Update JavaScript documentation
Browse files Browse the repository at this point in the history
- discovered during testing that if the thing passed to the event listener is the same name as the function it ultimately calls, Jasmine gets confused when trying to apply spyOn
  • Loading branch information
andysellick committed Feb 1, 2024
1 parent 22a48a0 commit b1b9f1e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/javascript-modules.md
Expand Up @@ -52,13 +52,13 @@ AnExampleModule.prototype.init = function ($module) {
if (consentCookie && consentCookie.usage) {
this.startModule()
} else {
this.startModule = this.startModule.bind(this)
window.addEventListener('cookie-consent', this.startModule)
this.start = this.startModule.bind(this)
window.addEventListener('cookie-consent', this.start)
}
}

AnExampleModule.prototype.startModule = function () {
window.removeEventListener('cookie-consent', this.startModule)
window.removeEventListener('cookie-consent', this.start)
// the rest of the module
}
```
Expand Down

0 comments on commit b1b9f1e

Please sign in to comment.