MCPcopy Create free account
hub / github.com/dashnowords/imfe / getScriptData

Function getScriptData

chapter04/1.requirejs-demo/require.js:1228–1242  ·  view source on GitHub ↗

* Given an event from a script node, get the requirejs info from it, * and then removes the event listeners on the node. * @param {Event} evt * @returns {Object}

(evt)

Source from the content-addressed store, hash-verified

1226 * @returns {Object}
1227 */
1228 function getScriptData(evt) {
1229 //Using currentTarget instead of target for Firefox 2.0's sake. Not
1230 //all old browsers will be supported, but this one was easy enough
1231 //to support and still makes sense.
1232 var node = evt.currentTarget || evt.srcElement;
1233
1234 //Remove the listeners once here.
1235 removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
1236 removeListener(node, context.onScriptError, 'error');
1237
1238 return {
1239 node: node,
1240 id: node && node.getAttribute('data-requiremodule')
1241 };
1242 }
1243
1244 function intakeDefines() {
1245 var args;

Callers 1

newContextFunction · 0.85

Calls 1

removeListenerFunction · 0.85

Tested by

no test coverage detected