Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Draw() {
var previous = arguments[0] === undefined ? null : arguments[0];
var options = arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, Draw);
this.type = "sink-draw";
var defaults = {
scroll: true,
color: "#000000"
};
_get(_core.Object.getPrototypeOf(Draw.prototype), "constructor", this).call(this, previous, options, defaults);
if (!this.params.canvas) {
return console.error("Please note: a canvas element is required for this module");
}
// pubs
this.scrolls = this.params.scroll;
this.canvas = this.params.canvas;
this.color = this.params.color;
// privs
this._buffer = document.createElement("canvas");
this._buffer.width = this.canvas.width;
this._buffer.height = this.canvas.height;
this._buffCtx = this._buffer.getContext("2d");
value: function update(data) {
_babelHelpers.get(_core.Object.getPrototypeOf(Breakpoint.prototype), "update", this).call(this, data);
this.sortData();
this.items = this.g.selectAll("." + this.param("unitClass")).data(this.data(), this.dataKey());
// create line
if (this.param("displayLine")) {
this.line = this.d3.svg.line().interpolate(this.param("interpolate"));
var path = this.g.select("path");
// create path if not exists
if (!path[0][0]) {
path = this.g.append("path");
};
// remove line if no data
if (this.data().length === 0) {
var queryBuffer = parent.selectBuffer[queryHash];
if (queryBuffer) {
_.pull(queryBuffer.handlers, this);
if (queryBuffer.handlers.length === 0) {
// No more query/params like this, remove from buffers
delete parent.selectBuffer[queryHash];
_.pull(parent.waitingToUpdate, queryHash);
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = _core.$for.getIterator(_core.Object.keys(parent.allTablesUsed)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var table = _step.value;
_.pull(parent.allTablesUsed[table], queryHash);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
function resourceToDocObject(resource) {
var res = _core.Object.assign({}, resource.attrs);
var getId = function (it) {
return it.id;
};
for (var key in resource.links) {
var linkage = resource.links[key].linkage.value;
// handle linkage when set explicitly for empty relationships
if (linkage === null || Array.isArray(linkage) && linkage.length === 0) {
res[key] = linkage;
} else {
res[key] = Array.isArray(linkage) ? linkage.map(getId) : linkage.id;
}
}
return res;
}
value: function load(base, d3) {
_get(_core.Object.getPrototypeOf(Waveform.prototype), "load", this).call(this, base, d3);
var sampleRate = this.sampleRate()();
var data = this.data();
data = data instanceof ArrayBuffer ? new Float32Array(data) : data;
var duration = data.length / sampleRate;
// bind rendering strategy
var strategy = renderingStrategies[this.param("renderingStrategy")];
this._update = strategy.update.bind(this);
this._draw = strategy.draw.bind(this);
// create partial xxScale
this.xxScale = this.d3.scale.linear().range([0, duration]);
// init worker
// if (this.param('useWorker')) { this.initWorker(); }
}
},
value: function update(data) {
_babelHelpers.get(_core.Object.getPrototypeOf(Label.prototype), "update", this).call(this, data);
this.items = this.g.selectAll("." + this.param("unitClass")).data(this.data(), this.sortIndex());
var sel = this.items.enter().append("g").classed("item", true).classed(this.param("unitClass"), true);
sel.append("rect").attr("class", "bounding-box").attr("fill", "transparent");
sel.append("text").attr("class", "text");
this.items.exit().remove();
},
writable: true,
if (isRegExp(options[k])) {
var _options;
(_options = options, !_babelHelpers.hasOwn.call(_options, "constraints") && (_options.constraints = {}), _options.constraints)[k] = options[k];
delete options[k];
}
});
var scopeOptions = {};
_core.Object.keys(options).forEach(function (k) {
if (!RESOURCE_OPTIONS.includes(k)) {
scopeOptions[k] = options[k];
delete options[k];
}
});
if (_core.Object.keys(scopeOptions).length) {
this.scope(scopeOptions, function () {
_this[method](resources.pop(), options, cb);
});
return true;
}
if (!this.isActionOptions(options)) {
if (this.isScopeActionOptions()) {
assign(options, this.scopeActionOptions());
}
}
return false;
},
writable: true,
var pathParams = ast.keys;
options = this.normalizeOptions(options, formatted, pathParams, ast, context.get("module"));
var contextConstraints = context.get("constraints");
if (contextConstraints) {
this.splitConstraints(ast.keys, contextConstraints);
}
var constraints = this.constraints(options, pathParams);
this.splitConstraints(pathParams, constraints);
if (isObject(optionsConstraints)) {
this.splitConstraints(pathParams, optionsConstraints);
for (var _iterator = _core.$for.getIterator(_core.Object.keys(optionsConstraints)), _step; !(_step = _iterator.next()).done;) {
var k = _step.value;
var v = optionsConstraints[k];
if (URL_OPTIONS.includes(k) && (isString(v) || isNumber(v))) {
var _defaults = this.defaults;
var _k = k;
if (!_babelHelpers.hasOwn.call(_defaults, _k)) _defaults[_k] = v;
}
}
}
this.normalizeFormat(formatted);
this.conditions.pathInfo = path;
this.conditions.parsedPathInfo = ast;
function Marker() {
_babelHelpers.classCallCheck(this, Marker);
_babelHelpers.get(_core.Object.getPrototypeOf(Marker.prototype), "constructor", this).call(this);
var defaults = {
type: "marker",
id: uniqueId(name),
displayHandle: true
};
this.params(defaults);
this.width(1);
this.color("#000000");
this.opacity("0.7");
this.data([{ x: 0 }]);
this.x(function (d) {
var v = arguments[1] === undefined ? null : arguments[1];
if (v !== null) {
function ContextEditionState(timeline) {
_classCallCheck(this, ContextEditionState);
_get(_core.Object.getPrototypeOf(ContextEditionState.prototype), "constructor", this).call(this, timeline);
}