Hello
Ater upgrading to jira 9, I’m facing the following problem in the console:
Uncaught TypeError: AJS.toInit is not a function
This is the js code:
AJS.toInit(function () {
logic();
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function () {
logic();
});
AJS.$(function () {
logic();
});
});
Thanks,
Ibrahim
Hi @IbrahimItani
please check this page → Preparing for Jira 9.0 | Atlassian Support | Atlassian Documentation and section App header updates & introducing deferred scripts to some Jira pages
Cheers
Adam
1 Like
Hello @adam.labus ,
I have read the article and it is great.
However can you please provide me an example?
Regards,
Hi @hagophadjiakian1
based on this page Preparing for Jira 9.0 | Atlassian Support | Atlassian Documentation
[cut]
Required updates
All global variables (e.g. jQuery
or AJS
) and AMD modules (e.g. jira/flag) won’t be immediately accessible on pages with deferred scripts. To address this:
- Postpone the execution of the script until
DOMContentLoaded
or later event occurs.
[/cut]
the easiest and fastest way is to use such a script
document.addEventListener('DOMContentLoaded', function(event) {
logic();
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function () {
logic();
});
AJS.$(function () {
logic();
});
});
Cheers
Adam
1 Like