File tree Expand file tree Collapse file tree
1-js/09-classes/07-mixins Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22let eventMixin = {
33
44 /**
5- * Subscribe to event, usage:
5+ * :متعهد ساختن به یک رویداد، کاربرد
66 * menu.on('select', function(item) { ... }
77 */
88 on ( eventName , handler ) {
1414 } ,
1515
1616 /**
17- * Cancel the subscription, usage:
17+ * :لغو کردن تعهد، کاربرد
1818 * menu.off('select', handler)
1919 */
2020 off ( eventName , handler ) {
2828 } ,
2929
3030 /**
31- * Generate the event and attach the data to it
31+ * ایجاد یک رویداد همراه با داده و نام داده شده
3232 * this.trigger('select', data1, data2);
3333 */
3434 trigger ( eventName , ...args ) {
3535 if ( ! this . _eventHandlers || ! this . _eventHandlers [ eventName ] ) {
36- return ; // no handlers for that event name
36+ return ; // کنترلکنندهای برای این نام رویداد وجود ندارد
3737 }
3838
39- // call the handlers
39+ // فراخوانی کنترلکنندهها
4040 this . _eventHandlers [ eventName ] . forEach ( handler => handler . apply ( this , args ) ) ;
4141 }
4242} ;
You can’t perform that action at this time.
0 commit comments