listen.js
/* INTENT: the listen method returns a list that if kept can be passed to this to release only
   what was created in that listen call */
the listen method returns a list that if kept can be passed to this to release only
what was created in that listen call
the listen method returns a list that if kept can be passed to this to release only what was created in that listen call
function release(releaselist){
    for(var i = 0; i < releaselist.length ; i ++){
        var entry = releaselist[i];
        var obj = entry[0], attr = entry[1], method = entry[2], context = entry[3], boundobject = entry[4];
        var listened_list = obj.__listeners__[attr] || [];
        for(var j = listened_list.length-1; j != -1; j --)
            if(listened_list[j][0] == method && listened_list[j][1] == context){
                listened_list.remove(j);
                if(listened_list.length == 0)
                    delete obj.__listeners__[attr];
                break;
            } 
        if(boundobject){
            var listening_list = boundobject.__listening__ || [];
            for(var j = listening_list.length-1; j != -1; j --){
                if(listening_list[j][0] == obj && listening_list[j][1] == attr && listening_list[j][2] == method){
                    listening_list.remove(j);
                    break;
                }
            }
        }
    }
}
function release ( releaselist ) { for ( var i = 0 ; i < releaselist . length ; i ++ ) { var entry = releaselist [ i ] ; var obj = entry [ 0 ] , attr = entry [ 1 ] , method = entry [ 2 ] , context = entry [ 3 ] , boundobject = entry [ 4 ] ; var listened_list = obj . __listeners__ [ attr ] || [ ] ; for ( var j = listened_list . length - 1 ; j != - 1 ; j -- ) if ( listened_list [ j ] [ 0 ] == method && listened_list [ j ] [ 1 ] == context ) { listened_list . remove ( j ) ; if ( listened_list . length == 0 ) delete obj . __listeners__ [ attr ] ; break ; } if ( boundobject ) { var listening_list = boundobject . __listening__ || [ ] ; for ( var j = listening_list . length - 1 ; j != - 1 ; j -- ) { if ( listening_list [ j ] [ 0 ] == obj && listening_list [ j ] [ 1 ] == attr && listening_list [ j ] [ 2 ] == method ) { listening_list . remove ( j ) ; break ; } } } } }
INTENT: the listen method returns a list that if kept can be passed to this to release only
what was created in that listen call
INTENT : the listen method returns a list that if kept can be passed to this to release only what was created in that listen call
/* use that information to find the registration (going backwards) removing them. */