From 7fb9bf8417f91f68c896eae9a2351493e9122aeb Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:24:06 +0200 Subject: [PATCH 1/6] google-maps definitions added --- google-maps/google-maps.d.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 google-maps/google-maps.d.ts diff --git a/google-maps/google-maps.d.ts b/google-maps/google-maps.d.ts new file mode 100644 index 000000000..753aa4f49 --- /dev/null +++ b/google-maps/google-maps.d.ts @@ -0,0 +1,26 @@ +// Type definitions for google-maps 3.1.0 +// Project: https://www.npmjs.com/package/google-maps +// Definitions by: Deividas Bakanas , Giedrius Grabauskas +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace GoogleMapsLoader { + interface CallBack { + (google: { maps: { Map: google.maps.Map } }): void; + } + export var KEY: string; + export var CLIENT: string; + export var VERSION: string; + export var SENSO: boolean; + export var LIBRARIES: Array; + export var LANGUAGE: string; + export function release(callBack: Function): void; + export function onLoad(callBack?: CallBack): void; + export function load(callBack?: CallBack): void; + export function isLoaded(): boolean; + +} +declare module 'google-maps' { + export = GoogleMapsLoader; +} From f3dcb689eaf3fc8f903051766cdc0791e97c5783 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:30:27 +0200 Subject: [PATCH 2/6] Created google-maps-tests file. --- google-maps/google-maps-tests.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 google-maps/google-maps-tests.ts diff --git a/google-maps/google-maps-tests.ts b/google-maps/google-maps-tests.ts new file mode 100644 index 000000000..2256b254b --- /dev/null +++ b/google-maps/google-maps-tests.ts @@ -0,0 +1,26 @@ +/// + +var GoogleMapsLoader = require('google-maps'); + +GoogleMapsLoader.load(function(google) { + new google.maps.Map(el, options); +}); + +GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm'; + +GoogleMapsLoader.CLIENT = 'yourclientkey'; +GoogleMapsLoader.VERSION = '3.14'; + +GoogleMapsLoader.SENSOR = true + +GoogleMapsLoader.LIBRARIES = ['geometry', 'places']; + +GoogleMapsLoader.LANGUAGE = 'fr'; + +GoogleMapsLoader.release(function() { + console.log('No google maps api around'); +}); + +GoogleMapsLoader.onLoad(function(google) { + console.log('I just loaded google maps api'); +}); From 64dc5896a52b88fbff3b793e3c71236f1692ed35 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:31:49 +0200 Subject: [PATCH 3/6] Edited authors links. --- google-maps/google-maps.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-maps/google-maps.d.ts b/google-maps/google-maps.d.ts index 753aa4f49..6c528c6ef 100644 --- a/google-maps/google-maps.d.ts +++ b/google-maps/google-maps.d.ts @@ -1,6 +1,6 @@ // Type definitions for google-maps 3.1.0 // Project: https://www.npmjs.com/package/google-maps -// Definitions by: Deividas Bakanas , Giedrius Grabauskas +// Definitions by: Deividas Bakanas , Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 50170b0b7a64cfc655177a953e71210d7f8c13c1 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:36:53 +0200 Subject: [PATCH 4/6] Fixed import. --- google-maps/google-maps-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-maps/google-maps-tests.ts b/google-maps/google-maps-tests.ts index 2256b254b..16f917b40 100644 --- a/google-maps/google-maps-tests.ts +++ b/google-maps/google-maps-tests.ts @@ -1,6 +1,6 @@ /// -var GoogleMapsLoader = require('google-maps'); +import GoogleMapsLoader = require('google-maps'); GoogleMapsLoader.load(function(google) { new google.maps.Map(el, options); From 91f11851435d731dc7e5524b32d0064d21fa90d9 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:39:56 +0200 Subject: [PATCH 5/6] Fixed tests. --- google-maps/google-maps-tests.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/google-maps/google-maps-tests.ts b/google-maps/google-maps-tests.ts index 16f917b40..50f848936 100644 --- a/google-maps/google-maps-tests.ts +++ b/google-maps/google-maps-tests.ts @@ -3,7 +3,7 @@ import GoogleMapsLoader = require('google-maps'); GoogleMapsLoader.load(function(google) { - new google.maps.Map(el, options); + var loadedMap = google.maps.Map; }); GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm'; @@ -11,7 +11,7 @@ GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm'; GoogleMapsLoader.CLIENT = 'yourclientkey'; GoogleMapsLoader.VERSION = '3.14'; -GoogleMapsLoader.SENSOR = true +GoogleMapsLoader.SENSOR = true; GoogleMapsLoader.LIBRARIES = ['geometry', 'places']; @@ -22,5 +22,6 @@ GoogleMapsLoader.release(function() { }); GoogleMapsLoader.onLoad(function(google) { + var loadedMap = google.maps.Map; console.log('I just loaded google maps api'); }); From c21a2d49821b1a7d882b85e72255cdcf1532d1a3 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:40:25 +0200 Subject: [PATCH 6/6] Fixed definition mistype. --- google-maps/google-maps.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-maps/google-maps.d.ts b/google-maps/google-maps.d.ts index 6c528c6ef..edc37822c 100644 --- a/google-maps/google-maps.d.ts +++ b/google-maps/google-maps.d.ts @@ -12,7 +12,7 @@ declare namespace GoogleMapsLoader { export var KEY: string; export var CLIENT: string; export var VERSION: string; - export var SENSO: boolean; + export var SENSOR: boolean; export var LIBRARIES: Array; export var LANGUAGE: string; export function release(callBack: Function): void;