Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Context HUB validation.

Avatar

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. 

5 Replies

Avatar

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. 

Avatar

Level 10

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

Avatar

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.

Avatar

Level 10

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

Avatar

Level 4

yes i did:(

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