#90 new
Michael Stillwell

add "context" support to glow.net.*

Reported by Michael Stillwell | August 11th, 2009 @ 02:44 PM | in 2.0

glow.events.addListener() has support for an optional 4th parameter which determines what "this" corresponds to within the callback. It would be useful if the glow.net.* methods supported something similar.

i.e. something to accomplish the following, but built-in:

    var self = this;
    glow.net.loadScript(
      "http://foo.com/?jsoncallback={callback}", 
      {
        onLoad: (function(context){

          // fn is the function for which we want to control the scope of "this"

          var fn = function(data) {
            // at this point, "this" refers to the same thing as "self"              
          };

          return function(data) {
            fn.apply(context, arguments)
          }

        })(this)
      }
    );

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A JavaScript Library

Shared Ticket Bins

Pages