Caught event in $.widget - now what?

Caught event in $.widget - now what?

Sorry to post this really dumb question.  I built myself a UI widget like so:

$.widget( "myWidget", {
    _init: function() {
        this.element.bind( "resize", function() {
            ???????._myPrivateFunc();
        } );
    },
    _myPrivateFun: function() {
        // do something
    }
});

and instantiate like so

var div= $("<div>").myWidget();

and later on fire a "resize" event like so

div.trigger("resize");

Good news is: the code finds its way into my resize handler.  Bad news is:  I have no idea how to find from the DOM element "this" (inside that handler) back to the widget instantiation such that the call to _myPrivateFunc() would actually resolve.

Could anyone point me in the right direction?  Thank you kindly.

PS:  I should mention that the firing code has no idea that myWidget is attached.  That is, it would not know how to look for the widget context, nor would it know how to call _trigger.
    • Topic Participants

    • olaf