If you are making the call in a JSP than you can make the call inside the tag <aui:script>
like this:
<aui:script use="liferay-session">
Liferay.session.extend();
</aui:script>
Or
<aui:script use="liferay-session">
function myCustomSessionExtend() {
Liferay.session.extend();
}
</aui:script>
Or if you are using a separate javascript file (*.js
) then I think the following should work:
AUI().use('liferay-session', function(A) {
Liferay.session.extend();
});
Or
function myCustomSessionExtend() {
AUI().use('liferay-session', function(A) {
Liferay.session.extend();
});
}
From Liferay 6.0 onwards Liferay uses Alloy UI as there default javascript library.
Alloy UI has a concept of sandboxing (the AUI().use (function(A) { ... });
creates a sandbox i.e. an isolated area for object) and modularity (it loads modules only when required, so liferay-session
is one such module created using Alloy UI).
For more information you can view this blog and this document.
Hope this would help resolve your issue.