3 Replies Latest reply on Jan 26, 2016 11:07 AM by jroorda

    Unable to retrieve app artifact context?

    jroorda

      I made a simple app, whose javascript is:

      gadgets.util.registerOnLoadHandler(function() {
          getContext();
      });
      
      
      function getContext(){
        //gadgets.ee.registerContextListener(function(context) {
          //console.log(context);
        //});
        opensocial.data.getDataContext().registerListener('org.opensocial.ee.context',function(key){
          var context = opensocial.data.getDataContext().getDataSet(key);
          console.log(context);
        });
      }
      
      
      function testfunc(){
          osapi.jive.core.container.closeApp({  
              data: {  
                  display: {  
                      type: "image",  
                      previewImage: "images/icon48.png", 
                      label: "Testing!"
                  },  
                  target: {  
                      type: "embed",  
                      view: "embedded",
                      context: {
                          test:"hi there"
                      }
                  }  
              }  
          });
      }
      
      
      
      
      
      

       

      where the HTML simply consists of a button that calls testfunc()

       

      the problem is that this (and attempting to use gadgets.ee.registerContextListener) prints nothing when opening the context through the app artifact

      no output, not even printing null

       

      is there something I am missing?

        • Re: Unable to retrieve app artifact context?
          Ryan Rutan

          What does your Javascript Console say?  If it doesn't even print null, sounds like it is a runtime error and the script is probably stopping?  Dont have the script handy to compare the rest of the code, but perhaps you can share your error output and we can start there?

            • Re: Unable to retrieve app artifact context?
              jroorda
              vendor.js:2757 [cycle] terminating; zero elements found by selector 272657670e0149902b4fd743133eecdf.js:31 
              Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.f7beebb23635ae85127ce96a2a2ed117.js:108 
              'KeyboardEvent.keyLocation' is deprecated. Please use 'KeyboardEvent.location' instead. 46855d04c7955564861e4e13f7e3246d.js:146 
              Object {display: Object, target: Object}
              

               

              There is no error output, the only output is the object output that creating the app artifact returns and deprecation warnings from jive scripts.

              These are all expected outputs.

              Note, the object that is outputted DOES contain the context in the correct location (target.context).

               

              Ryan Rutan

              • Re: Unable to retrieve app artifact context?
                jroorda

                ignore my deleted comment, unrelated issue. This does not work on the public sandbox either.