Page MenuHomePhorge

test_native_bind_debug.js
No OneTemporary

Size
872 B
Referenced Files
None
Subscribers
None

test_native_bind_debug.js

// 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

Mime Type
text/plain
Expires
Wed, Jun 17, 1:04 PM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
565497
Default Alt Text
test_native_bind_debug.js (872 B)

Event Timeline