Created
March 7, 2017 13:06
-
-
Save ScalableJS/a87b51e0e4d3685c961d88e6f845bc72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $ACTION = function (eventName) { | |
var SESSION_EVENT_NAME = 'MM_' + eventName; | |
var catchEvent = function (fn) { | |
var sessionEventValue = window.sessionStorage[SESSION_EVENT_NAME]; | |
if (typeof fn == 'function' && sessionEventValue) { | |
fn(sessionEventValue) | |
} | |
delete window.sessionStorage[SESSION_EVENT_NAME]; | |
}; | |
var postpone = function (value) { | |
window.sessionStorage[SESSION_EVENT_NAME] = value; | |
}; | |
return { | |
catchEvent: catchEvent, | |
postpone: postpone | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment