@rdkmaster/jigsaw-labs
Version:
Jigsaw, the next generation component set for RDK
90 lines (89 loc) • 3 kB
TypeScript
import { OnInit, ViewContainerRef, OnDestroy } from "@angular/core";
/**
* 方便的定义一个渲染器视图的插槽
*/
export declare class JigsawRendererHost {
viewContainerRef: ViewContainerRef;
constructor(viewContainerRef: ViewContainerRef);
}
export declare class JigsawCommonModule {
}
export interface IDynamicInstantiatable {
initData: any;
}
/**
* Jigsaw所有的组件都实现这个接口
*/
export interface IJigsawComponent {
/**
* @internal
*/
basicClass: string;
width: string;
height: string;
maxHeight: string;
}
/**
* 一般来说,应用无需关注此类
*/
export declare abstract class AbstractJigsawViewBase implements OnInit, OnDestroy {
private _timerCache;
/**
* Angular的`OnInit`钩子是否已经执行过,是则为true,否则为false。
* 方便子类判断当前组件的状态。
*
* @type {boolean}
*/
protected initialized: boolean;
/**
* 延迟一会再执行一些逻辑,用法和`setTimeout`一模一样,差别在于更加安全,当组件被销毁了后,
* `setTimeout`里已经设置的逻辑依然会被执行,这在某些特定情况下会造成意外,从而造成组件出错。
* 使用本方法启动的异步逻辑在组件销毁之后,不再被执行。
*
* @param {Function} handler 需要延迟执行的函数
*/
protected callLater(handler: Function): any;
/**
* @param {Function} handler 需要延迟执行的函数
* @param {number} timeout 延迟的毫秒数
*/
protected callLater(handler: Function, timeout: number): any;
/**
* @param {Function} handler 需要延迟执行的函数
* @param {any} context `handler`函数执行的上下文
*/
protected callLater(handler: Function, context: any): any;
/**
* @param {Function} handler 需要延迟执行的函数
* @param context `handler`函数执行的上下文
* @param {number} timeout 延迟的毫秒数
*/
protected callLater(handler: Function, context: any, timeout: number): any;
/**
* 终止`callLater`所发起的异步任务,用法与`clearTimeout`非常类似,但是更加安全,
* 可以顺便将`callLater`所缓存的定时器序号删除。
*
* @param {number} handle `callLater`的返回值
*/
protected clearCallLater(handle: number): void;
ngOnInit(): void;
ngOnDestroy(): void;
}
/**
* 一般来说,应用无需关注此类
*/
export declare abstract class AbstractJigsawComponent extends AbstractJigsawViewBase implements IJigsawComponent {
/**
* @internal
*/
basicClass: string;
protected _width: string;
protected _height: string;
protected _maxHeight: string;
width: string;
height: string;
maxHeight: string;
}
export interface IJigsawFormControl {
valid: boolean;
}