UNPKG

@arcgis/map-components

Version:
43 lines (42 loc) 2.02 kB
/// <reference types="@arcgis/core/interfaces.d.ts" /> import { BaseComponent, EventEmitter, GenericController } from '@arcgis/components-controllers'; import { Nil } from '@arcgis/components-utils'; import { default as MapView } from '@arcgis/core/views/MapView'; import { default as SceneView } from '@arcgis/core/views/SceneView'; import { default as LinkChartView } from '@arcgis/core/views/LinkChartView'; import { ArcgisReferenceElement } from '../utils/component-utils'; type View = LinkChartView | MapView | SceneView; type ViewControllerRequires<ViewType extends View> = BaseComponent & ViewControllerUses<ViewType>; export interface ViewControllerUses<ViewType extends View> { view?: Nil | ViewType; position: __esri.UIPosition; referenceElement: ArcgisReferenceElement | Nil | string; arcgisReady: EventEmitter; el: HTMLElement & { childElem?: HTMLElement & { ownedBy?: HTMLElement; }; view?: Nil | ViewType; }; autoDestroyDisabled: boolean; destroy: () => Promise<void>; } /** * Creates a controller which adds a `view` property to the component and connects the component to that view, both when * the view is provided directly or linked via the `referenceElement` property. The controller also handles emitting the * `arcgisViewReady` event and removing the component from the view's UI when the component is disconnected. */ export declare const useView: <ViewType extends View = View>(component: ViewControllerRequires<ViewType>) => ViewType | undefined; export declare class ViewController<ViewType extends View = View> extends GenericController<ViewType | undefined, ViewControllerRequires<ViewType>> { private _view$; private _viewDestroyHandle; private _arcgisReadyEmitted; constructor(component: ViewControllerRequires<ViewType>); hostConnected(): void; hostLoad(): void; hostLoaded(): void; hostDisconnected(): void; hostDestroy(): void; private _watchMetaProperties; } export {};