Reputation:
I have an object with a function in a JS
file.
I am able to invoke that function from a different JS
file doing the following:
car.getCar();
but in the worklight adapter I'm not able to do so. How can I achieve this?
Thanks!
Upvotes: 0
Views: 58
Reputation: 2681
You can make use of WL.Server.invokeProcedure()
API to do this. This way you can invoke a procedure in the second adapter , from the first adapter
More details in this link.
Upvotes: 0
Reputation: 564
You need to count on your realm to share values between your adapters.
The only APIs you can use are WL.Server.setActiveUser(Realm_Name, userIdentity); / WL.Server.getActiveUser(Realm_Name);
For example:
Let's say you have an array of values in one adapter like
var userIdentity = {
name : "Test1",
Age : 26
}
on first adapter, use WL.Server.setActiveUser(Realm_Name, userIdentity)
;
to retrieve the userIdentity on the second adapter:
var name = WL.Server.getActiveUser(Realm_Name).name;
var age = WL.Server.getActiveUser(Realm_Name).age;
PS, your realm name will the one set in your authentication config on the server side.
You could use the above work with functions.
Upvotes: 1