mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-03 23:42:50 +00:00
New definition for non npm package amap-js-api-overview (#38761)
This commit is contained in:
parent
b2c017037d
commit
36c00a1bed
52
types/amap-js-api-overview/amap-js-api-overview-tests.ts
Normal file
52
types/amap-js-api-overview/amap-js-api-overview-tests.ts
Normal file
@ -0,0 +1,52 @@
|
||||
declare const map: AMap.Map;
|
||||
|
||||
declare const tileLayer: AMap.TileLayer;
|
||||
|
||||
// $ExpectType OverView<TileLayer>
|
||||
new AMap.OverView();
|
||||
// $ExpectType OverView<TileLayer>
|
||||
new AMap.OverView({});
|
||||
// $ExpectType OverView<TileLayer>
|
||||
const overview = new AMap.OverView({
|
||||
tileLayer,
|
||||
isOpen: true,
|
||||
visible: true
|
||||
});
|
||||
|
||||
// $ExpectType void
|
||||
overview.show();
|
||||
|
||||
// $ExpectType void
|
||||
overview.hide();
|
||||
|
||||
// $ExpectType void
|
||||
overview.open();
|
||||
|
||||
// $ExpectType void
|
||||
overview.close();
|
||||
|
||||
// $ExpectType void
|
||||
overview.setTileLayer(tileLayer);
|
||||
|
||||
// $ExpectType TileLayer
|
||||
overview.getTileLayer();
|
||||
|
||||
overview.on('show', (event: AMap.OverView.EventMap['show']) => {
|
||||
// $ExpectType "show"
|
||||
event.type;
|
||||
});
|
||||
|
||||
overview.on('hide', (event: AMap.OverView.EventMap['hide']) => {
|
||||
// $ExpectType "hide"
|
||||
event.type;
|
||||
});
|
||||
|
||||
overview.on('open', (event: AMap.OverView.EventMap['open']) => {
|
||||
// $ExpectType "open"
|
||||
event.type;
|
||||
});
|
||||
|
||||
overview.on('close', (event: AMap.OverView.EventMap['close']) => {
|
||||
// $ExpectType "close"
|
||||
event.type;
|
||||
});
|
||||
64
types/amap-js-api-overview/index.d.ts
vendored
Normal file
64
types/amap-js-api-overview/index.d.ts
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
// Type definitions for non-npm package amap-js-api-overview 1.4
|
||||
// Project: https://lbs.amap.com/api/javascript-api/reference/map-control#AMap.OverView
|
||||
// Definitions by: breeze9527 <https://github.com/breeze9527>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference types="amap-js-api" />
|
||||
|
||||
declare namespace AMap {
|
||||
namespace OverView {
|
||||
interface EventMap {
|
||||
show: Event<'show'>;
|
||||
hide: Event<'hide'>;
|
||||
open: Event<'open'>;
|
||||
close: Event<'close'>;
|
||||
}
|
||||
interface Options<L extends TileLayer = TileLayer> {
|
||||
/**
|
||||
* 鹰眼窗体中需显示的切片图层
|
||||
*/
|
||||
tileLayer?: L;
|
||||
/**
|
||||
* 鹰眼是否展开,默认为false
|
||||
*/
|
||||
isOpen?: boolean;
|
||||
/**
|
||||
* 鹰眼是否显示,默认为true
|
||||
*/
|
||||
visible?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图鹰眼插件
|
||||
*/
|
||||
class OverView<L extends TileLayer = TileLayer> extends EventEmitter {
|
||||
constructor(options?: OverView.Options<L>);
|
||||
/**
|
||||
* 显示鹰眼窗体
|
||||
*/
|
||||
show(): void;
|
||||
/**
|
||||
* 隐藏鹰眼窗体
|
||||
*/
|
||||
hide(): void;
|
||||
/**
|
||||
* 展开鹰眼窗口
|
||||
*/
|
||||
open(): void;
|
||||
/***
|
||||
* 折叠鹰眼窗口
|
||||
*/
|
||||
close(): void;
|
||||
/**
|
||||
* 设置鹰眼中需显示的切片图层
|
||||
* @param tileLayer 切片图层
|
||||
*/
|
||||
setTileLayer(tileLayer: L): void;
|
||||
/**
|
||||
* 获取窗体中显示的切片图层
|
||||
*/
|
||||
getTileLayer(): L;
|
||||
}
|
||||
}
|
||||
24
types/amap-js-api-overview/tsconfig.json
Normal file
24
types/amap-js-api-overview/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noEmit": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"amap-js-api-overview-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/amap-js-api-overview/tslint.json
Normal file
3
types/amap-js-api-overview/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user