New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add hasEventListener for CCEventDispatcher #425
Conversation
* | ||
* @return True if dispatching events is exist | ||
*/ | ||
bool hasEventListener(std::string listenerID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool hasEventListener(std::string listenerID)
-> bool hasEventListener(const std::string& listenerID) const
@@ -857,6 +857,11 @@ void EventDispatcher::dispatchCustomEvent(const std::string &eventName, void *op | |||
dispatchEvent(&ev); | |||
} | |||
|
|||
bool EventDispatcher::hasEventListener(std::string listenerID) | |||
{ | |||
return getListeners(listenerID) != nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getListeners接收的参数类型不是std::string啊
已经修复 @minggo |
* | ||
* @return True if dispatching events is exist | ||
*/ | ||
bool hasEventListener(const EventListener::ListenerID& listenerID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool hasEventListener(const EventListener::ListenerID& listenerID) -> bool hasEventListener(const EventListener::ListenerID& listenerID) const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpp里的实现函数也需要改
refine for_each_tuple
https://github.com/cocos-creator/fireball/issues/4862
添加 hasEventListener 函数
@minggo @pandamicro @dumganhar 看看如果没问题谁合并一下 thx