Skip to content

Commit 8d0c6d0

Browse files
authored
Merge pull request #5 from github/register-once
Register custom element just once
2 parents 4baaa3d + 66694e4 commit 8d0c6d0

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/file-attachment-element.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Attachment from './attachment'
22

3-
class FileAttachmentElement extends HTMLElement {
3+
export default class FileAttachmentElement extends HTMLElement {
44
constructor() {
55
super()
66
this.addEventListener('dragenter', onDragenter)
@@ -48,13 +48,6 @@ class FileAttachmentElement extends HTMLElement {
4848
}
4949
}
5050

51-
export default FileAttachmentElement
52-
53-
if (!window.customElements.get('file-attachment')) {
54-
window.FileAttachmentElement = FileAttachmentElement
55-
window.customElements.define('file-attachment', FileAttachmentElement)
56-
}
57-
5851
function hasFile(transfer: DataTransfer): boolean {
5952
return Array.from(transfer.types).indexOf('Files') >= 0
6053
}

0 commit comments

Comments
 (0)