Format the TypeScript files (#877)

This commit is contained in:
woxtu
2022-10-28 17:48:27 +09:00
committed by GitHub
parent 1c53d91c6b
commit 9543019336
13 changed files with 235 additions and 286 deletions

View File

@@ -1,10 +1,9 @@
import type { Runtime } from '../runtime';
import type {PyProxy} from "pyodide"
import type { PyProxy } from 'pyodide';
import { getLogger } from '../logger';
const logger = getLogger('py-register-widget');
function createWidget(runtime: Runtime, name: string, code: string, klass: string) {
class CustomWidget extends HTMLElement {
shadow: ShadowRoot;
@@ -65,14 +64,14 @@ export function make_PyWidget(runtime: Runtime) {
this.wrapper = document.createElement('slot');
this.shadow.appendChild(this.wrapper);
this.addAttributes('src','name','klass');
this.addAttributes('src', 'name', 'klass');
}
addAttributes(...attrs:string[]){
for (const each of attrs){
const property = each === "src" ? "source" : each;
addAttributes(...attrs: string[]) {
for (const each of attrs) {
const property = each === 'src' ? 'source' : each;
if (this.hasAttribute(each)) {
this[property]=this.getAttribute(each);
this[property] = this.getAttribute(each);
}
}
}