Updates to google maps docs.

I would do more, but I'll see what kind of feedback I get first from these changes.
This commit is contained in:
Thiery Laverdure 2016-08-04 08:31:51 -04:00 committed by GitHub
parent 2503ef2ee5
commit 049903222a

View File

@ -51,7 +51,9 @@ export const GoogleMapsAnimation = {
* ... * ...
* *
* // somewhere in your component * // somewhere in your component
* let map = new GoogleMap('elementID'); * let map = new GoogleMap('elementID', {
* // Map Options: https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapOptions
});
* *
* map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!')); * map.on(GoogleMapsEvent.MAP_READY).subscribe(() => console.log('Map is ready!'));
* ``` * ```
@ -65,8 +67,9 @@ export class GoogleMap {
_objectInstance: any; _objectInstance: any;
/** /**
* Checks if a map object has been created. * Checks if a map object has been created and is available.
* @return {Promise<boolean>} returns a promise that resolves with a boolean that indicates if the plugin is available. *
* @return {Promise<boolean>}
*/ */
@Cordova() @Cordova()
static isAvailable(): Promise<boolean> { static isAvailable(): Promise<boolean> {
@ -77,6 +80,11 @@ export class GoogleMap {
this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options); this._objectInstance = plugin.google.maps.Map.getMap(document.getElementById(elementId), options);
} }
/**
* Listen to a map event.
*
* @return {Observable<any>}
*/
on(event: any): Observable<any> { on(event: any): Observable<any> {
return new Observable( return new Observable(
(observer) => { (observer) => {
@ -86,13 +94,17 @@ export class GoogleMap {
); );
} }
/**
* Listen to a map event only once.
*
* @return{ Promise<any>}
*/
one(event: any): Promise<any> { one(event: any): Promise<any> {
return new Promise<any>( return new Promise<any>(
resolve => this._objectInstance.one(event, resolve) resolve => this._objectInstance.one(event, resolve)
); );
} }
@CordovaInstance({ sync: true }) @CordovaInstance({ sync: true })
setDebuggable(isDebuggable: boolean): void { setDebuggable(isDebuggable: boolean): void {
} }
@ -102,7 +114,9 @@ export class GoogleMap {
} }
/** /**
* Get the position of the camera * Get the position of the camera.
*
* @return {Promise<CameraPosition>}
*/ */
@CordovaInstance() @CordovaInstance()
getCameraPosition(): Promise<CameraPosition> { getCameraPosition(): Promise<CameraPosition> {
@ -110,7 +124,9 @@ export class GoogleMap {
} }
/** /**
* Get the location of the user * Get the location of the user.
*
* @return {Promise<MyLocation>}
*/ */
@CordovaInstance() @CordovaInstance()
getMyLocation(): Promise<MyLocation> { getMyLocation(): Promise<MyLocation> {
@ -118,7 +134,9 @@ export class GoogleMap {
} }
/** /**
* Get the visible region * Get the visible region.
*
* @return {Promise<VisibleRegion>}
*/ */
@CordovaInstance() @CordovaInstance()
getVisibleRegion(): Promise<VisibleRegion> { getVisibleRegion(): Promise<VisibleRegion> {