mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Fix event target type check issue
This commit is contained in:
@@ -239,7 +239,7 @@ proto.hasEventListener = function (type, checkCapture) {
|
||||
*/
|
||||
proto.on = function (type, callback, target, useCapture) {
|
||||
// Accept also patameters like: (type, callback, useCapture)
|
||||
if (useCapture === undefined) {
|
||||
if (typeof target === 'boolean') {
|
||||
useCapture = target;
|
||||
target = undefined;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ proto.on = function (type, callback, target, useCapture) {
|
||||
*/
|
||||
proto.off = function (type, callback, target, useCapture) {
|
||||
// Accept also patameters like: (type, callback, useCapture)
|
||||
if (useCapture === undefined) {
|
||||
if (typeof target === 'boolean') {
|
||||
useCapture = target;
|
||||
target = undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user