Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #1666, add a browser-send-event module that ensures that sendEven…
Browse files Browse the repository at this point in the history
…t is defined even if ga-activation.js fails
  • Loading branch information
ianb committed Oct 6, 2016
1 parent a34983b commit 561ea05
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 6 deletions.
13 changes: 13 additions & 0 deletions server/src/browser-send-event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* This module exists because on some browsers we find that ga-analytics doesn't get loaded */

if (typeof window != "undefined" && window.sendEvent) {
module.exports = window.sendEvent;
} else {
module.exports = function () {
if (window.sendEvent) {
window.sendEvent.apply(null, arguments);
} else {
console.log.apply(console, ["missing sendEvent("].concat(Array.from(arguments).concat([")"])));
}
};
}
2 changes: 1 addition & 1 deletion server/src/clientglue.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* jslint browser:true */
/* globals sendEvent */

const sendEvent = require("./browser-send-event.js");
let ReactDOM = require("react-dom"),
{ FrameFactory } = require("./views/frame.js"),
{ setGitRevision, staticLink } = require("./linker"),
Expand Down
2 changes: 1 addition & 1 deletion server/src/pages/leave-page-shot/controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* globals sendEvent */
// const page = require("./page").page;

const sendEvent = require("../../browser-send-event.js");
let helperReadyResolve;
let helperReadyPromise = new Promise((resolve, reject) => {
helperReadyResolve = resolve;
Expand Down
3 changes: 2 additions & 1 deletion server/src/pages/leave-page-shot/view.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals location, sendEvent */
/* globals location */
const sendEvent = require("../../browser-send-event.js");
const reactruntime = require("../../reactruntime");
const React = require("react");

Expand Down
2 changes: 1 addition & 1 deletion server/src/pages/shotindex/controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals sendEvent */
const sendEvent = require("../../browser-send-event.js");
const page = require("./page").page;
const { AbstractShot } = require("../../../shared/shot");

Expand Down
3 changes: 2 additions & 1 deletion server/src/pages/shotindex/view.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* globals location, controller, sendEvent */
/* globals location, controller */
const sendEvent = require("../../browser-send-event.js");
const reactruntime = require("../../reactruntime");
const { Footer } = require("../../footer-view.js");
const React = require("react");
Expand Down
2 changes: 1 addition & 1 deletion server/src/views/profile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals sendEvent */
//const sendEvent = require("../browser-send-event.js");
const React = require("react");
const ReactDOM = require("react-dom");
const events = require("../events");
Expand Down

0 comments on commit 561ea05

Please sign in to comment.