MCPcopy
hub / github.com/plotly/plotly.js / _makeWrapper

Function _makeWrapper

test/jasmine/tests/sankey_test.js:1139–1165  ·  view source on GitHub ↗
(eventType, mouseFn)

Source from the content-addressed store, hash-verified

1137 afterEach(destroyGraphDiv);
1138
1139 function _makeWrapper(eventType, mouseFn) {
1140 var posByElementType = {
1141 node: [410, 300],
1142 link: [450, 300]
1143 };
1144
1145 return function(elType) {
1146 return new Promise(function(resolve, reject) {
1147 const handler = (d) => {
1148 Lib.clearThrottle();
1149 const isNode = d.points[0].hasOwnProperty('sourceLinks');
1150 const isExpectedType = (elType === 'node') ? isNode : !isNode;
1151 if (!isExpectedType) {
1152 gd.once(eventType, handler);
1153 return;
1154 }
1155 resolve(d);
1156 }
1157 gd.once(eventType, handler);
1158
1159 mouseFn(posByElementType[elType]);
1160 setTimeout(function() {
1161 reject(eventType + ' did not get called!');
1162 }, 100);
1163 });
1164 };
1165 }
1166
1167 var _hover = _makeWrapper('plotly_hover', function(pos) {
1168 mouseEvent('mouseover', pos[0], pos[1]);

Callers 1

sankey_test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…