MCPcopy Create free account
hub / github.com/plotly/plotly.js / bindingValueHasChanged

Function bindingValueHasChanged

src/plots/command.js:209–240  ·  view source on GitHub ↗
(gd, binding, cache)

Source from the content-addressed store, hash-verified

207};
208
209function bindingValueHasChanged(gd, binding, cache) {
210 var container, value, obj;
211 var changed = false;
212
213 if(binding.type === 'data') {
214 // If it's data, we need to get a trace. Based on the limited scope
215 // of what we cover, we can just take the first trace from the list,
216 // or otherwise just the first trace:
217 container = gd._fullData[binding.traces !== null ? binding.traces[0] : 0];
218 } else if(binding.type === 'layout') {
219 container = gd._fullLayout;
220 } else {
221 return false;
222 }
223
224 value = Lib.nestedProperty(container, binding.prop).get();
225
226 obj = cache[binding.type] = cache[binding.type] || {};
227
228 if(obj.hasOwnProperty(binding.prop)) {
229 if(obj[binding.prop] !== value) {
230 changed = true;
231 }
232 }
233
234 obj[binding.prop] = value;
235
236 return {
237 changed: changed,
238 value: value
239 };
240}
241
242/*
243 * Execute an API command. There's really not much to this; it just provides

Callers 1

command.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…