Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
request(method: string, path: string, body?: {}, options?: {}, responseOutput?: { response: Response}): Promise {
let requestOptions = extend(true, {headers: {}}, this.defaults || {}, options || {}, {method, body});
let contentType = requestOptions.headers['Content-Type'] || requestOptions.headers['content-type'];
// if body is object, stringify to json or urlencoded depending on content-type
if (typeof body === 'object' && body !== null && contentType) {
requestOptions.body = (/^application\/(.+\+)?json/).test(contentType.toLowerCase())
? JSON.stringify(body)
: buildQueryString(body);
}
return this.client.fetch(path, requestOptions).then((response: Response) => {
if (response.status >= 200 && response.status < 400) {
if (responseOutput) {
responseOutput.response = response;
}
return response.json().catch(() => null);
render() {
// Setup scales
this.x = this.settings.x ? this.chart.scale(this.settings.x) : null;
this.y = this.settings.y ? this.chart.scale(this.settings.y) : null;
updateScaleSize(this, 'x', this.rect.width);
updateScaleSize(this, 'y', this.rect.height);
// Return an empty array to abort rendering when no scales are available to renderer
if (!this.x && !this.y) {
return [];
}
this.settings.ticks = extend({ show: true }, this.style.ticks, this.settings.ticks || {});
this.settings.minorTicks = extend({ show: false }, this.style.minorTicks, this.settings.minorTicks || {});
// Setup lines for X and Y
this.lines = {
x: [],
y: []
};
// Use the lineGen function to generate appropriate ticks
this.lines.x = lineGen(this.x, this.rect.width);
this.lines.y = lineGen(this.y, this.rect.height);
// Set all Y lines to flipXY by default
// This makes the transposer flip them individually
this.lines.y = this.lines.y.map((i) => extend(i, { flipXY: true }));
// Grab a video, make it a texture
this.videoTexture = new Texture(this.video)
this.videoTexture.minFilter = LinearFilter
this.videoTexture.magFilter = LinearFilter
this.shaderManager = new ShaderManager(this.videoTexture)
this.shaderManager.add(GreyscaleShader)
this.shaderManager.add(DotsShader)
this.shaderManager.add(TVShader)
// Use rendered scene as a material
// And something to cast shadows onto
const planeSize = this.getGeometrySize()
const planeGeometry = new PlaneGeometry(planeSize, planeSize, 1, 1)
this.uniforms = extend(TextureShader.uniforms, {
texture: {type: 't', value: this.shaderManager.texture()},
resolution: {type: 'v2', value: new Vector2(window.innerWidth, window.innerHeight)},
time: {type: 'f', value: 0.0}
})
this.planeMaterial = new ShaderMaterial({
vertexShader: TextureShader.vertexShader,
fragmentShader: TextureShader.fragmentShader,
uniforms: this.uniforms
})
this.plane = new Mesh(planeGeometry, this.planeMaterial)
this.scene.add(this.plane)
// Resize things when the window resizes
window.addEventListener('resize', this.onResize.bind(this))
}
getOrthographicSizes () {
set initialViewBox(value) {
// Set initial viewbox
if (value !== null) {
if (typeof value === "string") {
viewBox = parseViewBoxString(value);
} else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === "object") {
viewBox = extend({}, defaultViewBox, value);
} else {
throw new Error('initialViewBox is of invalid type');
}
}
_initialViewBox = extend({}, viewBox);
},
get animationTime() {
throw 'Patch paths must not have trailing slashes or empty keys!'
}
let parent = obj
for (let key of keys) {
// create path if any point is missing
if ((mkpath && (parent[key] === undefined || parent[key] === null)) || isBaseType(parent[key], false)) {
parent[key] = {}
}
parent = parent[key]
}
if (merge) {
parent[last_key] = deepMerge(parent[last_key], new_val)
} else {
parent[last_key] = new_val
}
return deepcopy ? extend(true, {}, obj) : obj
}
removeChild(c) {
c._stage = null;
let desc = c.descendants,
num = desc ? desc.length : 0,
i;
// remove reference to stage from all descendants
for (i = 0; i < num; i++) {
desc[i]._stage = null;
}
NC.removeChild.call(this, c);
if (this._collider && this._collider.type === 'bounds') {
this.__boundingRect = { true: null, false: null };
this.__bounds = { true: null, false: null };
const opts = extend(this.boundingRect(true), { type: 'bounds' });
this.collider = opts;
}
return this;
}
const headerFactory = (toDeriveFrom: any) => {
const lrn = extend({}, toDeriveFrom);
lrn.header = (toRet: string) => {
if (lrn.hasOwnProperty(toRet)) {
return lrn[toRet];
}
return undefined;
};
return lrn;
};
let tmpOutput = expressRequestInformationExtractor(
_nonce : store.getNonce()
};
},
processResults : function (result, params) {
return {
results : result.data,
};
}
},
minimumInputLength : 3,
templateResult : state => this.template(state),
templateSelection : state => this.template(state),
escapeMarkup : markup => markup,
};
return extend(true, settings, this.attributes.settings);
},
.map((a) => valueFn(extend({ datum: a.data }, ctx)))
.reverse()
boundingRect(includeTransform = false) {
if (this.__boundingRect[includeTransform] !== null) {
return this.__boundingRect[includeTransform];
}
const num = this.children.length;
for (let i = 0; i < num; i++) {
this.appendChildRect(this.children[i], includeTransform);
}
this.__boundingRect[includeTransform] = extend({
x: 0, y: 0, width: 0, height: 0
}, this.__boundingRect[includeTransform]);
return this.__boundingRect[includeTransform];
}