MCPcopy Create free account
hub / github.com/microsoft/SandDance / trap

Function trap

docs/app/js/sanddance-app.js:142161–142169  ·  view source on GitHub ↗
(view, fn)

Source from the content-addressed store, hash-verified

142159 return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background());
142160}
142161function trap(view, fn) {
142162 return !fn ? null : function() {
142163 try {
142164 fn.apply(this, arguments);
142165 } catch (error) {
142166 view.error(error);
142167 }
142168 };
142169}
142170function initializeHandler(view, prevHandler, el, constructor) {
142171 // instantiate scenegraph handler
142172 const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view); // transfer event handlers

Callers 3

initializeHandlerFunction · 0.70
addOperatorListenerFunction · 0.70
addEventListenerFunction · 0.70

Calls 1

errorMethod · 0.45

Tested by

no test coverage detected