Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Context HUB validation.

tc82
Level 4
Level 4

hello all,

am implementing the context hub in our aem sites.

i have been checking the following condition:

ContextHub.eventing.on(ContextHub.Constants.EVENT_INITIALIZED + ":STORENAME", function(event, data) {

this condition is never true.

 

May i know what is wrong here. 

0 Replies
smacdonald2008
Level 10
Level 10

Can you please post your full code example - including the full Java file. The issue may be it's in an OSGi method that is never fired. 

smacdonald2008
Level 10
Level 10

Also - we are releasing an AEM API article on this subject in the next week or so. 

tc82
Level 4
Level 4

thank you for the quick reply.

Am using the following check, after store is created and configured.:

if (window.ContextHub) {         

            ContextHub.eventing.on("data" + ":store",function(event,data) {
                setHeader.call(this);
            });
            ContextHub.eventing.on(ContextHub.Constants.EVENT_DATA_UPDATE + ":profile", function(event, data) {
                setHeader.call(this);
            });

            setHeader.call(this);
        }

 

the both two conditions never work.

If you see the setHeader.call without any check it works fine

AM using the context hub values and setting them in the setheader.call method.

When i do the following on the browser console

ContextHub.getStore('Storename').getTree():

i see data.

i don't know whats wrong the above checks:(

this check is used in the js files of my code.

smacdonald2008
Level 10
Level 10

Did you set a break point in the browser and step through the code. THat may help you debug the issue.

tc82
Level 4
Level 4

yes i did:(

DO i have to enable any configurations in OSGI to make this work?