Unanswered
JavaScript Event Hooks in UUX Payload
I was directed to this boilerplate code for registering post-login and logoff event hooks. I am interested in knowing what other events are available to subscribe to using this boilerplate. For instance, is it possible to listen for when the user navigates to different pages?
// Everything below here can be ignored, just registration boilerplate
var _uux_payload_registered = false;
var register = function () {
if (window.Ngam && !_uux_payload_registered) {
// this is a bunch of backwards compatibility afordances to make sure the hook registers
var loginFlow = Ngam.__container__.lookup('service:loginFlow');
var loginController = Ngam.__container__.lookup('controller:login');
var loginFlowReq = loginController && loginController.get('loginFlowRequirements');
if (loginFlow && loginFlow.authenticatedStatus === 200) {
postLoginHook(loginFlow);
} else if (loginFlowReq && loginFlowReq.authenticatedStatus === 200) {
postLoginHook(loginFlowReq);
} else {
Ngam.__container__.lookup('controller:application').get('notificationCenter').on('POST_LOGIN', postLoginHook);
}
Ngam.__container__.lookup('controller:application').get('notificationCenter').on('BEFORE_LOGOFF', afterLogoffHook);
_uux_payload_registered = true;
}
};
window.addEventListener('load', register);
ready(register);
setTimeout(function () {
register();
});
if (window.Ngam) {
register();
}
171 Views
0
Answers
3 years ago
3 years ago
Tags
Hey Jared,
Any uses of
— Kristopher Van Houten 3 years agoNgam.__container__.lookupare things we try to avoid because they are reaching into the internals of the application and, depending on your usage, put the integrity of the application at risk. As such, we do not publicly publish or document the full extent of what you can do with these lookups. If there is something you are specifically looking to do, we suggest opening a support ticket so we can walk you through it privately.Thank you, Kristopher!
— Jared Feldman 3 years ago