static-google-map
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -239,3 +239,3 @@ 'use strict'; | ||
destination: destinationLocation, | ||
travelMode: travelMode.toUpperCase() | ||
travelMode: travelMode && travelMode.toUpperCase() | ||
}, function (result, status) { | ||
@@ -293,30 +293,2 @@ if (status === window.google.maps.DirectionsStatus.OK) { | ||
// export const memoizeDirectionStrategy = (directionStrategy, cache = {}) => { | ||
// return function({ props }, parentProps) { | ||
// const key = JSON.stringify(props); | ||
// if (cache[key]){ | ||
// return cache[key]; | ||
// } else { | ||
// const promise = directionStrategy.apply(null, arguments).then(strat => { | ||
// // When this finally resolves, set the value of the cache to | ||
// // the string path result. Subsequent renders will return a string | ||
// // and use the base component instead of the Async component and | ||
// // not cause the flash | ||
// cache[key] = strat; | ||
// if (parentProps.onCacheUpdate) { | ||
// parentProps.onCacheUpdate({ ...cache }); | ||
// } | ||
// return strat; | ||
// }); | ||
// // Return the pending promise immedietly and the StaticGoogleMap | ||
// // usage of the Async component will eventually handle it because | ||
// // this function returned a Promise. This piece of the code prevents | ||
// // multiple calls to google on each render, but does not solve the | ||
// // "flash" of the Async component. | ||
// cache[key] = promise; | ||
// return promise; | ||
// } | ||
// } | ||
// } | ||
var directionStrategy = function directionStrategy(props, mapProps, requestStrategy) { | ||
@@ -383,3 +355,3 @@ var origin = props.origin, | ||
points: 'enc:' + path | ||
}, parentProps); | ||
}, mapProps); | ||
}); | ||
@@ -386,0 +358,0 @@ }; |
@@ -235,3 +235,3 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
destination: destinationLocation, | ||
travelMode: travelMode.toUpperCase() | ||
travelMode: travelMode && travelMode.toUpperCase() | ||
}, function (result, status) { | ||
@@ -289,30 +289,2 @@ if (status === window.google.maps.DirectionsStatus.OK) { | ||
// export const memoizeDirectionStrategy = (directionStrategy, cache = {}) => { | ||
// return function({ props }, parentProps) { | ||
// const key = JSON.stringify(props); | ||
// if (cache[key]){ | ||
// return cache[key]; | ||
// } else { | ||
// const promise = directionStrategy.apply(null, arguments).then(strat => { | ||
// // When this finally resolves, set the value of the cache to | ||
// // the string path result. Subsequent renders will return a string | ||
// // and use the base component instead of the Async component and | ||
// // not cause the flash | ||
// cache[key] = strat; | ||
// if (parentProps.onCacheUpdate) { | ||
// parentProps.onCacheUpdate({ ...cache }); | ||
// } | ||
// return strat; | ||
// }); | ||
// // Return the pending promise immedietly and the StaticGoogleMap | ||
// // usage of the Async component will eventually handle it because | ||
// // this function returned a Promise. This piece of the code prevents | ||
// // multiple calls to google on each render, but does not solve the | ||
// // "flash" of the Async component. | ||
// cache[key] = promise; | ||
// return promise; | ||
// } | ||
// } | ||
// } | ||
var directionStrategy = function directionStrategy(props, mapProps, requestStrategy) { | ||
@@ -379,3 +351,3 @@ var origin = props.origin, | ||
points: 'enc:' + path | ||
}, parentProps); | ||
}, mapProps); | ||
}); | ||
@@ -382,0 +354,0 @@ }; |
@@ -241,3 +241,3 @@ (function (global, factory) { | ||
destination: destinationLocation, | ||
travelMode: travelMode.toUpperCase() | ||
travelMode: travelMode && travelMode.toUpperCase() | ||
}, function (result, status) { | ||
@@ -295,30 +295,2 @@ if (status === window.google.maps.DirectionsStatus.OK) { | ||
// export const memoizeDirectionStrategy = (directionStrategy, cache = {}) => { | ||
// return function({ props }, parentProps) { | ||
// const key = JSON.stringify(props); | ||
// if (cache[key]){ | ||
// return cache[key]; | ||
// } else { | ||
// const promise = directionStrategy.apply(null, arguments).then(strat => { | ||
// // When this finally resolves, set the value of the cache to | ||
// // the string path result. Subsequent renders will return a string | ||
// // and use the base component instead of the Async component and | ||
// // not cause the flash | ||
// cache[key] = strat; | ||
// if (parentProps.onCacheUpdate) { | ||
// parentProps.onCacheUpdate({ ...cache }); | ||
// } | ||
// return strat; | ||
// }); | ||
// // Return the pending promise immedietly and the StaticGoogleMap | ||
// // usage of the Async component will eventually handle it because | ||
// // this function returned a Promise. This piece of the code prevents | ||
// // multiple calls to google on each render, but does not solve the | ||
// // "flash" of the Async component. | ||
// cache[key] = promise; | ||
// return promise; | ||
// } | ||
// } | ||
// } | ||
var directionStrategy = function directionStrategy(props, mapProps, requestStrategy) { | ||
@@ -385,3 +357,3 @@ var origin = props.origin, | ||
points: 'enc:' + path | ||
}, parentProps); | ||
}, mapProps); | ||
}); | ||
@@ -388,0 +360,0 @@ }; |
{ | ||
"name": "static-google-map", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "dist/static-google-map.cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/static-google-map.esm.js", |
63779
1256