While developing server apps, one relies heavily on AJS. I’ve searched through the internet and just realised I cannot find any centralised documentation on AJS like we have for Cloud AP (https://developer.atlassian.com/cloud/jira/platform/jsapi/ap/). I think it just occurred to me that all this while of using AJS I might have been using knowledge scattered everywhere on the internet to use the AJS library.
If there is such centralised AJS documentation, please can someone kindly point me to it?
Please, I’m not referring to AUI because from my understanding, that depends on some parts of . AJS but still doesn’t really document AJS.
1 Like
Thanks Daniel . Please is there documentation for AJS.toInit anywhere there? I cannot seem to find it.
1 Like
There’s this:
Please be reminded to use the toInit
method everytime AJS
is called. This will ensure that the JQuery codes are called only after AJS has been succesfully initialized. In order to use the toInit
method, include the following:
AJS.toInit(function(){
<!-- INSERT THE JS CODES HERE -->
});
And this:
The recommended way to load scripts when the page is ready, known as ‘on-DOM-ready’, is to use the Atlassian JavaScript (AJS) abstraction. This avoids depending on a particular JavaScript library that may not remain in Confluence.
AJS.toInit(function () {
// ... your initialisation code here
});
This has the additional benefit of ensuring any functions or variables you declare here are not in the global scope, which is important for best interoperability with other plugins in Confluence.
2 Likes