1 | declare namespace google.maps {
|
2 | namespace event {
|
3 | |
4 |
|
5 |
|
6 |
|
7 |
|
8 | function addDomListener(
|
9 | instance: object,
|
10 | eventName: string,
|
11 | handler: (event: Event) => void,
|
12 | capture?: boolean,
|
13 | ): MapsEventListener;
|
14 |
|
15 | |
16 |
|
17 |
|
18 |
|
19 | function addDomListenerOnce(
|
20 | instance: object,
|
21 | eventName: string,
|
22 | handler: (event: Event) => void,
|
23 | capture?: boolean,
|
24 | ): MapsEventListener;
|
25 |
|
26 | |
27 |
|
28 |
|
29 |
|
30 |
|
31 | function addListener(instance: object, eventName: string, handler: (...args: any[]) => void): MapsEventListener;
|
32 |
|
33 | |
34 |
|
35 |
|
36 |
|
37 | function addListenerOnce(
|
38 | instance: object,
|
39 | eventName: string,
|
40 | handler: (...args: any[]) => void,
|
41 | ): MapsEventListener;
|
42 |
|
43 | |
44 |
|
45 |
|
46 | function clearInstanceListeners(instance: object): void;
|
47 |
|
48 | |
49 |
|
50 |
|
51 | function clearListeners(instance: object, eventName: string): void;
|
52 |
|
53 | |
54 |
|
55 |
|
56 |
|
57 | function removeListener(listener: MapsEventListener): void;
|
58 |
|
59 | |
60 |
|
61 |
|
62 |
|
63 | function trigger(instance: any, eventName: string, ...args: any[]): void;
|
64 | }
|
65 |
|
66 | interface MapsEventListener {
|
67 | |
68 |
|
69 |
|
70 |
|
71 | remove(): void;
|
72 | }
|
73 |
|
74 | type MVCEventHandler<T extends MVCObject, A extends any[]> = (this: T, ...args: A) => void;
|
75 |
|
76 | class MVCObject {
|
77 | |
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | constructor();
|
85 |
|
86 | /**
|
87 | * Adds the given listener function to the given event name. Returns an
|
88 | * identifier for this listener that can be used with
|
89 | * google.maps.event.removeListener.
|
90 | */
|
91 | addListener(eventName: string, handler: MVCEventHandler<this, any[]>): MapsEventListener;
|
92 |
|
93 | /** Binds a View to a Model. */
|
94 | bindTo(key: string, target: MVCObject, targetKey?: string, noNotify?: boolean): void;
|
95 |
|
96 | changed(key: string): void;
|
97 |
|
98 | /** Gets a value. */
|
99 | get(key: string): any;
|
100 |
|
101 | /**
|
102 | * Notify all observers of a change on this property. This notifies both
|
103 | * objects that are bound to the object's property as well as the object
|
104 | * that it is bound to.
|
105 | */
|
106 | notify(key: string): void;
|
107 |
|
108 | /** Sets a value. */
|
109 | set(key: string, value: any): void;
|
110 |
|
111 | /** Sets a collection of key-value pairs. */
|
112 | setValues(values: any): void;
|
113 |
|
114 | /**
|
115 | * Removes a binding. Unbinding will set the unbound property to the current
|
116 | * value. The object will not be notified, as the value has not changed.
|
117 | */
|
118 | unbind(key: string): void;
|
119 |
|
120 | /** Removes all bindings. */
|
121 | unbindAll(): void;
|
122 | }
|
123 |
|
124 | /** This class extends MVCObject. */
|
125 | class MVCArray<T> extends MVCObject {
|
126 |
|
127 | constructor(array?: T[]);
|
128 |
|
129 | /** Removes all elements from the array. */
|
130 | clear(): void;
|
131 |
|
132 | /**
|
133 | * Iterate over each element, calling the provided callback.
|
134 | * The callback is called for each element like: callback(element, index).
|
135 | */
|
136 | forEach(callback: (elem: T, i: number) => void): void;
|
137 |
|
138 | /**
|
139 | * Returns a reference to the underlying Array.
|
140 | * Warning: if the Array is mutated, no events will be fired by this object.
|
141 | */
|
142 | getArray(): T[];
|
143 |
|
144 | /** Returns the element at the specified index. */
|
145 | getAt(i: number): T;
|
146 |
|
147 | /** Returns the number of elements in this array. */
|
148 | getLength(): number;
|
149 |
|
150 | /** Inserts an element at the specified index. */
|
151 | insertAt(i: number, elem: T): void;
|
152 |
|
153 | /** Removes the last element of the array and returns that element. */
|
154 | pop(): T;
|
155 |
|
156 | /**
|
157 | * Adds one element to the end of the array and returns the new length of
|
158 | * the array.
|
159 | */
|
160 | push(elem: T): number;
|
161 |
|
162 | /** Removes an element from the specified index. */
|
163 | removeAt(i: number): T;
|
164 |
|
165 | /** Sets an element at the specified index. */
|
166 | setAt(i: number, elem: T): void;
|
167 | }
|
168 | }
|