[ 2 posts ]

Marc

YUI Contributor

  • Offline
  • Profile

_EVENTS

Post Posted: Sat Oct 01, 2011 10:09 am
+0-
Hi,

I keep getting No type found in XYZ, key: el error and juding from the code, it doesn't seem to be in line with the examples:
Code:
_EVENTS:{
            slider: {
               mousedown:'_onMouseDown',
               gesturemove:'_onDragMove'
            }
         },

Code:
Y.each(Y.Array(handlers), function (handler) {
                    fn = null;
                    if (Lang.isString(handler)) {
                        type = handler;
                        args = null;
                    } else if (Lang.isObject(handler)) {
                        type = handler.type;
                        fn = handler.fn;
                        args = handler.args;
                    } else {
                        Y.log('Bad event handler for class: ' + c.NAME + ' key: ' + key,'error','MakeNode');
                    }


in this case, handler (slider) will always be an object and type, fn and args will always be null.

Am I missing something?

Cheers,
Marc

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: _EVENTS

Post Posted: Mon Oct 03, 2011 10:03 am
+0-
Sorry for the delay, I was sure I was subscribed to this forum and got alerts of new posts on my email, I'll have to check that.

The syntax of the _EVENTS objects was changed from the original version of MakeNode (as per the first version of article) to the one in the gallery.

{{{
_EVENTS:{
slider: [
{type:'mousedown', fn:'_onMouseDown'},
{type:'gesturemove',fn:'_onDragMove'}
]
},
}}}

or, if you accept the default method names, you could do:


{{{
_EVENTS:{
slider: [
'mousedown', // will call this._afterSliderMousedown
'gesturemove' // will call this._afterSliderGesturemove
]
},
}}}
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum