@devboldly/react-use-google-analytics-embed-api
Advanced tools
Comparing version 0.0.38 to 0.0.39
@@ -44,9 +44,14 @@ "use strict"; | ||
React.useEffect(function () { | ||
var aborted = false; | ||
var authorizedListener = function (isAuthorized) { | ||
setAuthorized(isAuthorized); | ||
if (!aborted) { | ||
setAuthorized(isAuthorized); | ||
} | ||
}; | ||
exports.apiStateEmitter.on('authorized', authorizedListener); | ||
var readyListener = function () { | ||
setGapi(exports.apiSingleton.gapi); | ||
setHookReady(true); | ||
if (!aborted) { | ||
setGapi(exports.apiSingleton.gapi); | ||
setHookReady(true); | ||
} | ||
}; | ||
@@ -53,0 +58,0 @@ exports.apiStateEmitter.on('ready', readyListener); |
@@ -27,6 +27,10 @@ "use strict"; | ||
React.useEffect(function () { | ||
var randNum = Math.random(); | ||
var aborted = false; | ||
var randNum = Math.random() * 1000000; | ||
var authorizedListener = function (isAuthorized) { | ||
console.log('Calling setAuthorized', randNum); | ||
setAuthorized(isAuthorized); | ||
console.log('Calling setAuthorized', randNum, 'aborted?', aborted); | ||
if (!aborted) { | ||
setAuthorized(isAuthorized); | ||
} | ||
console.log('Stats from', randNum, ' - Called for:', useAnalyticsApi_1.apiStateEmitter.listenerCount, 'listeners.'); | ||
}; | ||
@@ -33,0 +37,0 @@ useAnalyticsApi_1.apiStateEmitter.on('authorized', authorizedListener); |
{ | ||
"name": "@devboldly/react-use-google-analytics-embed-api", | ||
"version": "0.0.38", | ||
"version": "0.0.39", | ||
"author": "Dev Boldly <devboldly@gmail.com>", | ||
@@ -33,5 +33,3 @@ "description": "React hook for loading the Google Analytics Embed API.", | ||
"keywords": [], | ||
"dependencies": { | ||
"@devboldly/react-use-window-global": "0.0.9" | ||
}, | ||
"dependencies": {}, | ||
"peerDependencies": { | ||
@@ -38,0 +36,0 @@ "react": "^16.13.0", |
92274
2
2089
- Removed@devboldly/react-use-window-global@0.0.9(transitive)