@devboldly/react-use-google-analytics-embed-api
Advanced tools
Comparing version 0.0.25 to 0.0.26
@@ -24,7 +24,12 @@ "use strict"; | ||
if (query.ids) { | ||
var newChart = new gapi.analytics.googleCharts.DataChart({ | ||
query: query, | ||
chart: chart, | ||
}); | ||
setDataChart(newChart); | ||
try { | ||
var newChart = new gapi.analytics.googleCharts.DataChart({ | ||
query: query, | ||
chart: chart, | ||
}); | ||
setDataChart(newChart); | ||
} | ||
catch (e) { | ||
console.log(e); | ||
} | ||
} | ||
@@ -31,0 +36,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { GoogleAnalyticsEmbedAPILoader } from './useGoogleAnalyticsEmbedApi'; | ||
import { GoogleAnalyticsEmbedAPILoader } from './useAnalyticsApi'; | ||
export declare const useViewSelector: (gapiLoader: GoogleAnalyticsEmbedAPILoader, viewSelectorId: string, onChange: (viewId: string) => void) => void; |
@@ -16,18 +16,23 @@ "use strict"; | ||
if (gapiLoader.ready && gapiLoader.gapi) { | ||
/** | ||
* Create a new ViewSelector instance to be rendered inside of an | ||
* element with the id "view-selector-container". | ||
*/ | ||
var newViewSelector = new gapiLoader.gapi.analytics.ViewSelector({ | ||
container: viewSelectorId, | ||
}); | ||
// Render the view selector to the page. | ||
newViewSelector.execute(); | ||
/** | ||
* Render the dataChart on the page whenever a new view is selected. | ||
*/ | ||
newViewSelector.on('change', function (viewId) { | ||
onChange(viewId); | ||
}); | ||
setViewSelector(newViewSelector); | ||
try { | ||
/** | ||
* Create a new ViewSelector instance to be rendered inside of an | ||
* element with the id provided. | ||
*/ | ||
var newViewSelector = new gapiLoader.gapi.analytics.ViewSelector({ | ||
container: viewSelectorId, | ||
}); | ||
// Render the view selector to the page. | ||
newViewSelector.execute(); | ||
/** | ||
* Render the dataChart on the page whenever a new view is selected. | ||
*/ | ||
newViewSelector.on('change', function (viewId) { | ||
onChange(viewId); | ||
}); | ||
setViewSelector(newViewSelector); | ||
} | ||
catch (e) { | ||
console.log(e); | ||
} | ||
} | ||
@@ -34,0 +39,0 @@ } |
export * from './hooks/GoogleAnalyticsEmbedAPI'; | ||
export * from './hooks/useAuthAuthorize'; | ||
export * from './hooks/useAuthorized'; | ||
export * from './hooks/useAnalyticsApi'; | ||
export * from './hooks/useAuthorize'; | ||
export * from './hooks/useDataChart'; | ||
export * from './hooks/useGoogleAnalyticsEmbedApi'; | ||
export * from './hooks/useViewSelector'; |
@@ -6,6 +6,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./hooks/useAuthAuthorize")); | ||
__export(require("./hooks/useAuthorized")); | ||
__export(require("./hooks/useAnalyticsApi")); | ||
__export(require("./hooks/useAuthorize")); | ||
__export(require("./hooks/useDataChart")); | ||
__export(require("./hooks/useGoogleAnalyticsEmbedApi")); | ||
__export(require("./hooks/useViewSelector")); |
{ | ||
"name": "@devboldly/react-use-google-analytics-embed-api", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"author": "Dev Boldly <devboldly@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "React hook to async load the Google Analytics Embed API.", |
88997
18
1976