Skip to content

Commit

Permalink
Making sure that when switching routes we don't accept events either
Browse files Browse the repository at this point in the history
  • Loading branch information
bondib authored Jan 5, 2017
1 parent 3acf1f6 commit 66c4311
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions public/hack.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ uiModules.get('app/dashboard', ['kibana/courier','ngRoute']).run(function ($root
let eventer = window[eventMethod];
let messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";

let lastReceievedData;
let lastReceievedData = null;;
let startAcceptingEvents = false;

let eventMessageHandler = function(e) {

console.log('received message!: ',e.data);
console.debug('received message!: ',e.data);
lastReceievedData = e;
if(!startAcceptingEvents)
{
Expand All @@ -73,7 +73,7 @@ uiModules.get('app/dashboard', ['kibana/courier','ngRoute']).run(function ($root
switch(topic)
{
case "searchRequest": // in case we got a search request:
console.log("Search request...")
console.debug("Search request...")
// parse the app + global states:
let passedInAppState = rison.decode(getQueryVariable("_a", urlData));
let passedInGlobalState = rison.decode(getQueryVariable("_g", urlData));
Expand Down Expand Up @@ -110,7 +110,9 @@ uiModules.get('app/dashboard', ['kibana/courier','ngRoute']).run(function ($root
return;
case "routeRequest": // in case we were requsted to route to a different area:

console.log("Route request...");
console.debug("Route request...");
lastReceievedData = null; // make sure we don't trigger the lastReceievedData in routeChangeSuccess
startAcceptingEvents = false; // we stop accepting events (we keep the last request anyways) - as accepting changes while loading a dashboard results in
indexOfDashSign = urlData.indexOf("#");
finalUri = urlData.substr(indexOfDashSign+1);
doNotSendRouteChangeNotificationToParent = true; // we do not want to send to our parent of the change (as he was the one who iniated this...)
Expand Down Expand Up @@ -139,8 +141,8 @@ uiModules.get('app/dashboard', ['kibana/courier','ngRoute']).run(function ($root
parent.postMessage("kibanaUpdateNotification###" + $location.url() , "*")
}
});

/* $rootScope.$on('$routeUpdate', () =>
/*
$rootScope.$on('$routeUpdate', () =>
{
console.debug("RECIVED $routeUpdate!")
});
Expand All @@ -159,9 +161,9 @@ uiModules.get('app/dashboard', ['kibana/courier','ngRoute']).run(function ($root
$rootScope.$on('$routeChangeStart', () =>
{
console.debug("RECIVED $routeChangeStart!")
});
});*/


*/

$rootScope.$on('$routeChangeSuccess', () =>
{
Expand Down

0 comments on commit 66c4311

Please sign in to comment.