mirror of
https://github.com/skooner-k8s/skooner.git
synced 2026-08-24 04:16:18 +00:00
convert base.js to ts
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
import {Component} from 'react';
|
||||
import log from '../utils/log';
|
||||
|
||||
export default class Base extends Component {
|
||||
interface Apis {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export default class Base<Props, States> extends Component<Props, States> {
|
||||
private apis: Apis = {};
|
||||
|
||||
async componentWillUnmount() {
|
||||
await this.clearDisposers();
|
||||
}
|
||||
|
||||
async registerApi(apis) {
|
||||
async registerApi(apis: Apis) {
|
||||
if (!this.apis) this.apis = {};
|
||||
|
||||
for (const [name, api] of Object.entries(apis)) {
|
||||
@@ -22,7 +28,7 @@ export default class Base extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
async clearDisposer(name) {
|
||||
async clearDisposer(name: string) {
|
||||
if (!this.apis || !this.apis[name]) return;
|
||||
|
||||
const item = this.apis[name];
|
||||
Reference in New Issue
Block a user