mirror of https://gitee.com/antv-l7/antv-l7
feat(scene): add once event for scene
This commit is contained in:
parent
a75f9511e3
commit
f84fea5c0e
|
@ -9,6 +9,7 @@ export interface ISceneService {
|
||||||
fontFamily: string;
|
fontFamily: string;
|
||||||
loadFont: boolean;
|
loadFont: boolean;
|
||||||
on(type: string, handle: (...args: any[]) => void): void;
|
on(type: string, handle: (...args: any[]) => void): void;
|
||||||
|
once(type: string, handle: (...args: any[]) => void): void;
|
||||||
off(type: string, handle: (...args: any[]) => void): void;
|
off(type: string, handle: (...args: any[]) => void): void;
|
||||||
removeAllListeners(event?: string): this;
|
removeAllListeners(event?: string): this;
|
||||||
init(config: IMapConfig & IRenderConfig): void;
|
init(config: IMapConfig & IRenderConfig): void;
|
||||||
|
|
|
@ -266,6 +266,12 @@ class Scene
|
||||||
: this.sceneService.on(type, handle);
|
: this.sceneService.on(type, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public once(type: string, handle: (...args: any[]) => void): void {
|
||||||
|
SceneEventList.indexOf(type) === -1
|
||||||
|
? this.mapService.once(type, handle)
|
||||||
|
: this.sceneService.once(type, handle);
|
||||||
|
}
|
||||||
|
|
||||||
public off(type: string, handle: (...args: any[]) => void): void {
|
public off(type: string, handle: (...args: any[]) => void): void {
|
||||||
SceneEventList.indexOf(type) === -1
|
SceneEventList.indexOf(type) === -1
|
||||||
? this.mapService.off(type, handle)
|
? this.mapService.off(type, handle)
|
||||||
|
|
Loading…
Reference in New Issue