Skip to content

Commit

Permalink
Merge pull request #5 from github/register-once
Browse files Browse the repository at this point in the history
Register custom element just once
  • Loading branch information
dgraham authored Mar 13, 2020
2 parents 4baaa3d + 66694e4 commit 8d0c6d0
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/file-attachment-element.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Attachment from './attachment'

class FileAttachmentElement extends HTMLElement {
export default class FileAttachmentElement extends HTMLElement {
constructor() {
super()
this.addEventListener('dragenter', onDragenter)
Expand Down Expand Up @@ -48,13 +48,6 @@ class FileAttachmentElement extends HTMLElement {
}
}

export default FileAttachmentElement

if (!window.customElements.get('file-attachment')) {
window.FileAttachmentElement = FileAttachmentElement
window.customElements.define('file-attachment', FileAttachmentElement)
}

function hasFile(transfer: DataTransfer): boolean {
return Array.from(transfer.types).indexOf('Files') >= 0
}
Expand Down

0 comments on commit 8d0c6d0

Please sign in to comment.