Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* Bind a key to another object
* @param key {string} The property name you want to observe.
* @param target {any} The target object you want to observe.
* @param targetKey? {string} [options] The property name you want to observe. If you omit this, the `key` argument is used.
* @param noNotify? {boolean} [options] True if you want to prevent `(key)_changed` event when you bind first time, because the internal status is changed from `undefined` to something.
*/
@CordovaInstance({ sync: true })
bindTo(key: string, target: any, targetKey?: string, noNotify?: boolean): void {
}
/**
* Alias of `addEventListener`
* @param key {string} The property name you want to observe.
* @return {Observable}
*/
@InstanceCheck({ observable: true })
on(eventName: string): Observable {
return new Observable((observer) => {
this._objectInstance.on(eventName, (...args: any[]) => {
const newArgs = normalizeArgumentsOfEventListener.call(this, this._objectInstance, args);
observer.next(newArgs);
});
});
}
/**
* Alias of `addThrottledEventListener`
* @param key {string} The property name you want to observe.
* @return {Observable}
*/
// @InstanceCheck({ observable: true })
// onThrottled(eventName: string): Observable {
}
});
resolve(overlay);
} else {
reject();
}
});
});
}
/**
* Adds a polygon in synchronous
* @param options {PolygonOptions} options
* @return {Polygon}
*/
@InstanceCheck()
addPolygonSync(options: PolygonOptions): Polygon {
const polygon: any = this._objectInstance.addPolygon(options);
const overlayId: string = polygon.getId();
const overlay = new Polygon(this, polygon);
this.get('_overlays')[overlayId] = overlay;
polygon.one(overlayId + '_remove', () => {
if (this.get('_overlays')) {
this.get('_overlays')[overlayId] = null;
overlay.destroy();
}
});
return overlay;
}
/**
* Adds a polyline
setPadding(top: number, right?: number, bottom?: number, left?: number): void { }
/**
* Set options
* @param options
*/
@CordovaInstance({ sync: true })
setOptions(options: GoogleMapOptions): void {
}
/**
* Adds a marker
* @param options {MarkerOptions} options
* @return {Promise
/**
* Injects CSS into the InAppBrowser window.
* @param css {Object} Details of the script to run, specifying either a file or code key.
* @returns {Promise}
*/
@CordovaInstance()
insertCSS(css: { file?: string; code?: string }): Promise {
return;
}
/**
* A method that allows you to listen to events happening in the browser.
* @param event {InAppBrowserEventType} Name of the event
* @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
*/
@InstanceCheck()
on(event: InAppBrowserEventType): Observable {
return new Observable(
(observer: Observer) => {
this._objectInstance.addEventListener(
event,
observer.next.bind(observer)
);
return () =>
this._objectInstance.removeEventListener(
event,
observer.next.bind(observer)
);
}
);
}
}
markerCluster.one(overlayId + '_remove', () => {
if (this.get('_overlays')) {
this.get('_overlays')[overlayId] = null;
overlay.destroy();
}
});
markerCluster.set('_overlays', new BaseArrayClass());
return overlay;
}
/**
* Adds a circle
* @param options {CircleOptions} options
* @return {Promise
* Injects CSS into the browser window.
* @param css Details of the script to run, specifying either a file or code key.
* @returns {Promise}
*/
@CordovaInstance()
insertCss(css: { file?: string; code?: string }): Promise {
return;
}
/**
* A method that allows you to listen to events happening in the browser.
* Available events are: `ThemeableBrowserError`, `ThemeableBrowserWarning`, `critical`, `loadfail`, `unexpected`, `undefined`
* @param event Event name
* @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.
*/
@InstanceCheck({ observable: true })
on(event: string): Observable {
return new Observable(observer => {
this._objectInstance.addEventListener(
event,
observer.next.bind(observer)
);
return () =>
this._objectInstance.removeEventListener(
event,
observer.next.bind(observer)
);
});
}
}
/**
@InstanceCheck()
clone(): Contact {
const newContact: any = new Contact();
for (const prop in this) {
if (prop === 'id') return;
newContact[prop] = this[prop];
}
return newContact;
}
@CordovaInstance()
remove(): Promise {
return;
}
@InstanceCheck()
save(): Promise {
return getPromise((resolve: Function, reject: Function) => {
this._objectInstance.save((contact: any) => {
this._objectInstance = contact;
resolve(this);
}, reject);
});
}
}
/**
* @hidden
*/
export interface IContactError {
/** Error code */
code: number;
});
markerCluster.set('_overlays', new BaseArrayClass());
resolve(overlay);
} else {
reject();
}
});
});
}
/**
* Adds a marker cluster in synchronous
* @param options {MarkerClusterOptions} options
* @Returns {MarkerCluster}
*/
@InstanceCheck()
addMarkerClusterSync(options: MarkerClusterOptions): MarkerCluster {
const markerCluster: any = this._objectInstance.addMarkerCluster(options);
const overlayId: string = markerCluster.getId();
const overlay: MarkerCluster = new MarkerCluster(this, markerCluster);
this.get('_overlays')[overlayId] = overlay;
markerCluster.one(overlayId + '_remove', () => {
if (this.get('_overlays')) {
this.get('_overlays')[overlayId] = null;
overlay.destroy();
}
});
markerCluster.set('_overlays', new BaseArrayClass());
return overlay;
}
/**
this.get('_overlays')[overlayId] = overlay;
marker.one(overlayId + '_remove', () => {
if (this.get('_overlays')) {
this.get('_overlays')[overlayId] = null;
overlay.destroy();
}
});
return overlay;
}
/**
* Adds a marker cluster
* @param options {MarkerClusterOptions} options
* @return {Promise}
*/
@InstanceCheck()
addMarkerCluster(options: MarkerClusterOptions): Promise {
return getPromise((resolve, reject) => {
this._objectInstance.addMarkerCluster(options, (markerCluster: any) => {
if (markerCluster) {
const overlayId = markerCluster.getId();
const overlay = new MarkerCluster(this, markerCluster);
this.get('_overlays')[overlayId] = overlay;
markerCluster.one('remove', () => {
if (this.get('_overlays')) {
this.get('_overlays')[overlayId] = null;
overlay.destroy();
}
});
markerCluster.set('_overlays', new BaseArrayClass());
resolve(overlay);
} else {
const overlay = new Circle(this, circle);
this.get('_overlays')[overlayId] = overlay;
circle.one(overlayId + '_remove', () => {
if (this.get('_overlays')) {
this.get('_overlays')[overlayId] = null;
overlay.destroy();
}
});
return overlay;
}
/**
* Adds a polygon
* @param options {PolygonOptions} options
* @return {Promise