Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7538721
test_native_bind_debug.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
872 B
Referenced Files
None
Subscribers
None
test_native_bind_debug.js
View Options
// Debug native function binding
const
target
=
new
EventTarget
();
console
.
log
(
'target:'
,
target
);
console
.
log
(
'typeof target:'
,
typeof
target
);
const
addEventListenerFn
=
target
.
addEventListener
;
console
.
log
(
'\naddEventListenerFn:'
,
addEventListenerFn
);
console
.
log
(
'typeof addEventListenerFn:'
,
typeof
addEventListenerFn
);
console
.
log
(
'\nTrying to call it directly:'
);
try
{
addEventListenerFn
.
call
(
target
,
'test'
,
()
=>
{
console
.
log
(
'Direct call worked!'
);
});
target
.
dispatchEvent
(
'test'
);
}
catch
(
e
)
{
console
.
log
(
'Error:'
,
e
);
}
console
.
log
(
'\nTrying to bind it:'
);
try
{
const
bound
=
addEventListenerFn
.
bind
(
target
);
console
.
log
(
'bound:'
,
bound
);
console
.
log
(
'typeof bound:'
,
typeof
bound
);
bound
(
'test'
,
()
=>
{
console
.
log
(
'Bound call worked!'
);
});
target
.
dispatchEvent
(
'test'
);
}
catch
(
e
)
{
console
.
log
(
'Error:'
,
e
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jun 17, 1:04 PM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
565497
Default Alt Text
test_native_bind_debug.js (872 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment