Guestbook example - unable to pass serviceprovider correctly to the navmanager.

32 views
Skip to first unread message

Ramesh S

unread,
Aug 9, 2011, 3:36:19 PM8/9/11
to relief-f...@googlegroups.com
I am still following the same example of guestbook. After the last issue was fixed, I got a few error messages, which pointed towards some parameters being not initialized. I thought I could fix it and made the following changes to gb.js. 
 var eventBus = new goog.events.EventTarget();
  
  var cache;
  /**
   * @type {relief.cache.Cache}
   * @private
  */
  this.cache_ = cache = new relief.cache.Cache();  
  
  var headers = new goog.structs.Map({
    'Content-Type': 'application/json'
  });  

  var rpc;
  /**
   * @type {relief.rpc.RPCService}
   * @private
  */
  this.rpc_ = rpc = new relief.rpc.RPCService(cache, headers);
  
  
  var auth;
  /**
   * @type {relief.auth.AuthManager}
   * @private
   */
  this.auth_ = auth = new relief.auth.AuthManager(eventBus);
  auth.setParentEventTarget(eventBus);

  var iframe = /** @type {!HTMLIFrameElement} */
           (goog.dom.getElement('history_frame')),
      input = /** @type {!HTMLInputElement} */
          (goog.dom.getElement('history_input')),
      content = /** @type {!Element} */ (goog.dom.getElement('content-root')); 

  var msgList = new gb.msg.MessageList();

followed by the existing code 


  // Replace instantiation of our old relief.handlers.CommonServiceProvider
  // with our snazzy new, and shorter-named, custom provider:
  var sp = new gb.ServiceProvider(msgList, gb.urls, cache, rpc, auth,
                                  iframe, input, content);

 
  // Then pass it to the NavManager, just like we used to.
  var nav;
  /**
   * @type {relief.nav.NavManager}
   * @private
   */
  this.nav_ = nav = new relief.nav.NavManager(sp);

But this doesn't seem to be working correctly. I read the guides but I am not sure if I am getting it right.

Thanks for the help.

Jay Young

unread,
Aug 9, 2011, 4:35:29 PM8/9/11
to relief-f...@googlegroups.com
There shouldn't be an event bus in the guestbook app.  If that was in the tutorial code somewhere, then I copy and pasted something incorrectly.  I used an event bus in the Relieved blog example app, but not here.  Do you see references to an event bus in the guestbook tutorial somewhere?

Ramesh S

unread,
Aug 9, 2011, 7:39:24 PM8/9/11
to relief-f...@googlegroups.com
My bad, I pasted the other code ( I was trying from the relieved blog ). I tried without event bus but it was giving error because accidentally I deleted the cache parameter from serviceprovider.

Thank you for the reply.
Reply all
Reply to author
Forward
0 new messages