Search code examples
yui3

How to register an event handler on a plugin in YUI3


Given the code below, is there a better way to register an event handler on the resize plugin? Thanks!

        var target = Y.Node.create('<div class="rich-text-container"></div>');

        // ...

        target.plug(Y.Plugin.Resize,{
            wrap : true
        });

        target[Y.Plugin.Resize.NS].on('resize:end',function (e) {
            debugger;
            // This runs, but is there a better way?
        });

Solution

  •     target.resize.on('resize:end',function (e) {
            alert('this is correct');
        });
    

    Y.Plugin.Resize.NS points to the string 'resize' and indicates where on the plugin host the plugin instance will be stored. Derp.