Merge pull request #14722 from DenisCarriere/patch-1

Extend Leaflet Util namespace
This commit is contained in:
Zhengbo Li
2017-02-22 12:03:23 -08:00
committed by GitHub
2 changed files with 40 additions and 0 deletions
+21
View File
@@ -1524,6 +1524,27 @@ declare namespace L {
export const svg: boolean;
}
export namespace Util {
export function extend(dest: any, src?: any): any;
export function create(proto: any, properties?: any): any;
export function bind(fn: () => void, ...obj: any[]): () => void;
export function stamp(obj: any): number;
export function throttle(fn: () => void, time: number, context: any): () => void;
export function wrapNum(num: number, range: number[], includeMax?: boolean): number;
export function falseFn(): () => false;
export function formatNum(num: number, digits?: number): number;
export function trim(str: string): string;
export function splitWords(str: string): string[];
export function setOptions(obj: any, options: any): any;
export function getParamString(obj: any, existingUrl?: string, uppercase?: boolean): string;
export function template(str: string, data: any): string;
export function isArray(obj: any): boolean;
export function indexOf(array: any[], el: any): number;
export function requestAnimFrame(fn: () => void, context?: any, immediate?: boolean): number;
export function cancelAnimFrame(id: number): void;
export let lastId: string;
export let emptyImageUrl: string;
}
}
declare module 'leaflet' {
+19
View File
@@ -447,3 +447,22 @@ L.marker([1, 2], {
iconUrl: 'my-icon.png'
})
}).bindPopup('<p>Hi</p>');
L.Util.extend({});
L.Util.create({});
L.Util.bind(() => {}, {});
L.Util.stamp({});
L.Util.throttle(() => {}, 123, {});
L.Util.wrapNum(123, []);
L.Util.falseFn();
L.Util.formatNum(123);
L.Util.trim('word ');
L.Util.splitWords('word word');
L.Util.setOptions({}, {});
L.Util.getParamString({});
L.Util.template('template', {});
L.Util.isArray({});
L.Util.indexOf([], {});
L.Util.requestAnimFrame(() => {});
L.Util.cancelAnimFrame(1);
L.Util.emptyImageUrl;