MCPcopy
hub / github.com/csev/py4e / connect

Function connect

tools/pythonauto/static/codemirrorepl/codemirrorepl.js:3061–3071  ·  view source on GitHub ↗
(node, type, handler, disconnect)

Source from the content-addressed store, hash-verified

3059 // Event handler registration. If disconnect is true, it'll return a
3060 // function that unregisters the handler.
3061 function connect(node, type, handler, disconnect) {
3062 if (typeof node.addEventListener == "function") {
3063 node.addEventListener(type, handler, false);
3064 if (disconnect) return function() {node.removeEventListener(type, handler, false);};
3065 }
3066 else {
3067 var wrapHandler = function(event) {handler(event || window.event);};
3068 node.attachEvent("on" + type, wrapHandler);
3069 if (disconnect) return function() {node.detachEvent("on" + type, wrapHandler);};
3070 }
3071 }
3072 CodeMirror.connect = connect;
3073
3074 function Delayed() {this.id = null;}

Callers 4

CodeMirrorFunction · 0.85
onMouseDownFunction · 0.85
onContextMenuFunction · 0.85
codemirrorepl.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected