Apply suggestions from code review
Co-authored-by: David Graham <dgraham@github.com>
This commit is contained in:
Родитель
4e425ff8ed
Коммит
84a053ee94
10
src/index.ts
10
src/index.ts
|
@ -50,11 +50,11 @@ export default class IncludeFragmentElement extends HTMLElement {
|
|||
this._attached = false
|
||||
}
|
||||
|
||||
static get observedAttributes() {
|
||||
static get observedAttributes(): string[] {
|
||||
return ['src']
|
||||
}
|
||||
|
||||
get src() {
|
||||
get src(): string {
|
||||
const src = this.getAttribute('src')
|
||||
if (src) {
|
||||
const link = this.ownerDocument!.createElement('a')
|
||||
|
@ -69,7 +69,7 @@ export default class IncludeFragmentElement extends HTMLElement {
|
|||
this.setAttribute('src', val)
|
||||
}
|
||||
|
||||
get accept() {
|
||||
get accept(): string {
|
||||
return this.getAttribute('accept') || ''
|
||||
}
|
||||
|
||||
|
@ -77,11 +77,11 @@ export default class IncludeFragmentElement extends HTMLElement {
|
|||
this.setAttribute('accept', val)
|
||||
}
|
||||
|
||||
get data() {
|
||||
get data(): Promise<string> {
|
||||
return getData(this)
|
||||
}
|
||||
|
||||
attributeChangedCallback(attribute: string) {
|
||||
attributeChangedCallback(attribute: string): void {
|
||||
if (attribute === 'src') {
|
||||
// Source changed after attached so replace element.
|
||||
if (this._attached) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"module": "es2020",
|
||||
"target": "es2017",
|
||||
"strict": true,
|
||||
"declaration": true,
|
||||
|
|
Загрузка…
Ссылка в новой задаче