Closed andreasplesch closed 8 years ago
Try
CB.bind(undefined, field, sensor)
Function CB (field, sensor, value) {}
Use
new CustomEvent(type, {detail: {value: val, fields: fields}})
https://www.w3.org/TR/DOM-Level-3-Events/#extending-events
event type should be prefixed
x3dCobwebFieldname ? cobwebFieldname ?
probably need to add nodename and def name to avoid namne collisions:
x3dCobwebTouchSensor_isActive
cobwebTouchSensor_isActive
check x3dom's convention: does not dispatch events, just has onoutputchange attribute with callback
+DEF in name, x3d as prefix: x3dTouchSensorTS1_isOver
Thinking more about it, adding the DEF name to the event type may not be ideal.
x3dTouchSensor_isOver
reads pretty well.
The event handler can still figure which TouchSensor the event came from. Let's just add a detail.name property to the event.
In most cases the listener will be attached to the Sensor element. Only listeners above in the hierarchy could capture the event which is probably rare and if there is one it is intentional, for example to capture all touchsensors' (plural) events.
Try that = this
Or context object