MCPcopy Index your code
hub / github.com/gpujs/gpu.js / bindKernelToShortcut

Function bindKernelToShortcut

src/kernel-run-shortcut.js:54–82  ·  view source on GitHub ↗
(kernel, shortcut)

Source from the content-addressed store, hash-verified

52}
53
54function bindKernelToShortcut(kernel, shortcut) {
55 if (shortcut.kernel) {
56 shortcut.kernel = kernel;
57 return;
58 }
59 const properties = utils.allPropertiesOf(kernel);
60 for (let i = 0; i < properties.length; i++) {
61 const property = properties[i];
62 if (property[0] === '_' && property[1] === '_') continue;
63 if (typeof kernel[property] === 'function') {
64 if (property.substring(0, 3) === 'add' || property.substring(0, 3) === 'set') {
65 shortcut[property] = function() {
66 shortcut.kernel[property].apply(shortcut.kernel, arguments);
67 return shortcut;
68 };
69 } else {
70 shortcut[property] = function() {
71 return shortcut.kernel[property].apply(shortcut.kernel, arguments);
72 };
73 }
74 } else {
75 shortcut.__defineGetter__(property, () => shortcut.kernel[property]);
76 shortcut.__defineSetter__(property, (value) => {
77 shortcut.kernel[property] = value;
78 });
79 }
80 }
81 shortcut.kernel = kernel;
82}
83module.exports = {
84 kernelRunShortcut
85};

Callers 1

kernelRunShortcutFunction · 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…