Hi,
I am trying to put some logic based on the value of a variable in session storage, based on session storage value i need to read some OSGI configuration. I am putting the read logic in use-API of HTL like below.
Component HTML file :-
<sly data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}">
<clientlib data-sly-call="${clientLib.js @ categories='digitalexp-ss-l9-navigation'}" data-sly-unwrap/>
</sly>
<div data-sly-use.roleLogic="clientlibs/navigation/js/role.js">
Logged In Role :- ${roleLogic.userRole}
</div>
JS file :-
"use strict";
use(function () {
var loggedInUserRole = window.sessionStorage.getItem("userRole");
return {
userRole:loggedInUserRole
};
});
But i am getting below exception even i dont include as clientLib:-
org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: org.mozilla.javascript.EcmaError: ReferenceError: "window" is not defined.
could anyone give some pointer how to read session storage value which is being populated by some external REST services.
Note :- i am using @AEM 6.3.2.2