Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af2bd3d

Browse files
committed
refactor: add code comments
1 parent b6212f7 commit af2bd3d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,18 @@ export default class IncludeFragmentElement extends HTMLElement {
163163
return response.text()
164164
})
165165
.then(data => {
166+
// Dispatch `load` and `loadend` async to allow
167+
// the `load()` promise to resolve _before_ these
168+
// events are fired.
166169
task().then(() => {
167170
this.dispatchEvent(new Event('load'))
168171
this.dispatchEvent(new Event('loadend'))
169172
})
170173
return data
171174
}, error => {
175+
// Dispatch `error` and `loadend` async to allow
176+
// the `load()` promise to resolve _before_ these
177+
// events are fired.
172178
task().then(() => {
173179
this.dispatchEvent(new Event('error'))
174180
this.dispatchEvent(new Event('loadend'))

0 commit comments

Comments
 (0)