_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q47500 | traverseTopDown | train | function traverseTopDown(fn) {
var result, i;
result = fn.call(this);
if(result)
return result;
if (this instanceof tree.ConsNode || this instanceof tree.ListNode) {
for (i = 0; i < this.length; i++) {
traverseTopDown.call(this[i], fn);
}
}
return this;
} | javascript | {
"resource": ""
} |
q47501 | ConsNode | train | function ConsNode(cons, children) {
this.cons = cons;
for(var i = 0; i < children.length; i++) {
this[i] = children[i];
}
this.length = children.length;
} | javascript | {
"resource": ""
} |
q47502 | findNodeAround | train | function findNodeAround(node, pos, test, base, state) {
test = makeTest(test);
if (!base) base = exports.base;
try {
;(function c(node, st, override) {
var type = override || node.type;
if (node.start > pos || node.end < pos) return;
base[type](node, st, c);
if (test(type, node)) throw... | javascript | {
"resource": ""
} |
q47503 | isIdentifierChar | train | function isIdentifierChar(code, astral) {
if (code < 48) return code === 36;
if (code < 58) return true;
if (code < 65) return false;
if (code < 91) return true;
if (code < 97) return code === 95;
if (code < 123) return true;
return code >= 0xaa;
} | javascript | {
"resource": ""
} |
q47504 | parseExpressionAt | train | function parseExpressionAt(input, pos, options) {
var p = new _state.Parser(options, input, pos);
p.nextToken();
return p.parseExpression();
} | javascript | {
"resource": ""
} |
q47505 | finishNodeAt | train | function finishNodeAt(node, type, pos, loc) {
node.type = type;
node.end = pos;
if (this.options.locations) node.loc.end = loc;
if (this.options.ranges) node.range[1] = pos;
return node;
} | javascript | {
"resource": ""
} |
q47506 | getOptions | train | function getOptions(opts) {
var options = {};
for (var opt in defaultOptions) {
options[opt] = opts && _util.has(opts, opt) ? opts[opt] : defaultOptions[opt];
}if (options.allowReserved == null) options.allowReserved = options.ecmaVersion < 5;
if (_util.isArray(options.onToken)) {
(function () {
... | javascript | {
"resource": ""
} |
q47507 | Token | train | function Token(p) {
this.type = p.type;
this.value = p.value;
this.start = p.start;
this.end = p.end;
if (p.options.locations) this.loc = new _locutil.SourceLocation(p, p.startLoc, p.endLoc);
if (p.options.ranges) this.range = [p.start, p.end];
} | javascript | {
"resource": ""
} |
q47508 | _minWidth | train | function _minWidth (col) {
var padding = col.padding || []
var minWidth = 1 + (padding[left] || 0) + (padding[right] || 0)
if (col.border) minWidth += 4
return minWidth
} | javascript | {
"resource": ""
} |
q47509 | measure | train | function measure(test, done) {
var start = now();
test(function (error, results) {
var stop = now();
done(error, results, stop - start);
});
} | javascript | {
"resource": ""
} |
q47510 | sample | train | function sample(test, asap, minDuration, sampleSize, done) {
var count = 0;
var totalDuration = 0;
var sampleDurations = [];
next();
function next() {
measure(function (done) {
test(asap, done);
}, function (error, results, duration) {
if (error) {
... | javascript | {
"resource": ""
} |
q47511 | assertOut | train | function assertOut(key, expected, result) {
var actual = result[key];
var statement = expected instanceof RegExp
? expected.test(actual)
: expected === actual;
if (statement !== true) {
var message = 'Expected ' + key +' to match "' + expected + '". Actual: "' + actual + '"';
return error(result,... | javascript | {
"resource": ""
} |
q47512 | error | train | function error(result, message, expected, actual) {
var err = new AssertionError('`' + result.cmd + '`: ' + message);
err.result = result;
if (expected) err.expected = expected;
if (actual) err.actual = actual;
return err;
} | javascript | {
"resource": ""
} |
q47513 | Result | train | function Result(cmd, code, options) {
options = options || {};
this.options = options;
this.code = code;
this.cmd = cmd;
} | javascript | {
"resource": ""
} |
q47514 | Runner | train | function Runner(options) {
if (!(this instanceof Runner)) return new Runner(options);
options = options || {};
this.options = options;
this.batch = new Batch;
this.world = new World;
this.expectations = [];
this.prompts = [];
this.responses = [];
this.baseCmd = '';
this.standardInput = null;
} | javascript | {
"resource": ""
} |
q47515 | World | train | function World(env, cwd) {
this.env = env || clone(process.env);
this.cwd = cwd;
this.timeout = null;
} | javascript | {
"resource": ""
} |
q47516 | cloneCounterValues | train | function cloneCounterValues(counters) {
const result = {};
Object.keys(counters).forEach(name => {
result[name] = Array.from(counters[name]);
});
return result;
} | javascript | {
"resource": ""
} |
q47517 | flattenTree | train | function flattenTree(root) {
let newChildren = [];
root.children.forEach(child => {
const commonParent = getDeepMoreThenOneChild(child);
if (commonParent.children.length === 0) {
newChildren.push(commonParent);
} else {
newChildren = newChildren.concat(commonParent.children);
}
});
r... | javascript | {
"resource": ""
} |
q47518 | normaliseDeps | train | function normaliseDeps (deps) {
if (Array.isArray(deps)) {
deps = deps.reduce(function (d, depName) {
d[depName] = '*'
return d
}, {})
}
return deps
} | javascript | {
"resource": ""
} |
q47519 | printWarnings | train | function printWarnings (deps, type) {
if (!Object.keys(deps).length) return
var warnings = {
E404: {title: 'Unregistered', list: []},
ESCM: {title: 'SCM', list: []},
EDEPTYPE: {title: 'Non-string dependency', list: []}
}
for (var name in deps) {
var dep = deps[name]
if (dep.warn) {
... | javascript | {
"resource": ""
} |
q47520 | getUpdatedDeps | train | function getUpdatedDeps (pkg, cb) {
var opts = {
stable: !argv.unstable,
loose: true,
error: {
E404: argv.error404,
ESCM: argv.errorSCM,
EDEPTYPE: argv.errorDepType
},
ignore: argv.ignore || argv.i
}
if (argv.registry) {
opts.npm = {registry: argv.registry}
}
david.... | javascript | {
"resource": ""
} |
q47521 | installDeps | train | function installDeps (deps, opts, cb) {
opts = opts || {}
var depNames = Object.keys(deps)
// Nothing to install!
if (!depNames.length) {
return cb(null)
}
depNames = depNames.filter(function (depName) {
return !deps[depName].warn
})
var npmOpts = {global: opts.global}
// Avoid warning me... | javascript | {
"resource": ""
} |
q47522 | isScm | train | function isScm (version) {
var scmPrefixes = ['git:', 'git+ssh:', 'https:', 'git+https:']
var blacklisted = scmPrefixes.filter(function (prefix) {
return version.indexOf(prefix) === 0
})
return !!blacklisted.length
} | javascript | {
"resource": ""
} |
q47523 | train | function() {
if (!started) {
// Since the application doesn't start running immediately, track
// whether this function was called and use that to keep it from
// starting the main loop multiple times.
started = true;
// In the main loop, draw() is ca... | javascript | {
"resource": ""
} | |
q47524 | animate | train | function animate(timestamp) {
// Run the loop again the next time the browser is ready to render.
// We set rafHandle immediately so that the next frame can be canceled
// during the current frame.
rafHandle = requestAnimationFrame(animate);
// Throttle the frame rate (if minFrameDelay is set to a ... | javascript | {
"resource": ""
} |
q47525 | build | train | function build (obj, opts) {
var XMLHDR = {
version: '1.0',
encoding: 'UTF-8'
};
var XMLDTD = {
pubid: '-//Apple//DTD PLIST 1.0//EN',
sysid: 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'
};
var doc = xmlbuilder.create('plist');
doc.dec(XMLHDR.version, XMLHDR.encoding, XMLHDR.standalone... | javascript | {
"resource": ""
} |
q47526 | walk_obj | train | function walk_obj(next, next_child) {
var tag_type, i, prop;
var name = type(next);
if ('Undefined' == name) {
return;
} else if (Array.isArray(next)) {
next_child = next_child.ele('array');
for (i = 0; i < next.length; i++) {
walk_obj(next[i], next_child);
}
} else if (Buffer.isBuffer... | javascript | {
"resource": ""
} |
q47527 | disableAll | train | function disableAll(win) {
debug(`Disabling all shortcuts on window ${title(win)}`);
const wc = win.webContents;
const shortcutsOfWindow = windowsWithShortcuts.get(wc);
for (const shortcut of shortcutsOfWindow) {
shortcut.enabled = false;
}
} | javascript | {
"resource": ""
} |
q47528 | enableAll | train | function enableAll(win) {
debug(`Enabling all shortcuts on window ${title(win)}`);
const wc = win.webContents;
const shortcutsOfWindow = windowsWithShortcuts.get(wc);
for (const shortcut of shortcutsOfWindow) {
shortcut.enabled = true;
}
} | javascript | {
"resource": ""
} |
q47529 | unregisterAll | train | function unregisterAll(win) {
debug(`Unregistering all shortcuts on window ${title(win)}`);
const wc = win.webContents;
const shortcutsOfWindow = windowsWithShortcuts.get(wc);
// Remove listener from window
shortcutsOfWindow.removeListener();
windowsWithShortcuts.delete(wc);
} | javascript | {
"resource": ""
} |
q47530 | register | train | function register(win, accelerator, callback) {
let wc;
if (typeof callback === 'undefined') {
wc = ANY_WINDOW;
callback = accelerator;
accelerator = win;
} else {
wc = win.webContents;
}
if (Array.isArray(accelerator) === true) {
accelerator.forEach(accelerator => {
if (typeof accelerator === 'string... | javascript | {
"resource": ""
} |
q47531 | unregister | train | function unregister(win, accelerator) {
let wc;
if (typeof accelerator === 'undefined') {
wc = ANY_WINDOW;
accelerator = win;
} else {
if (win.isDestroyed()) {
debug(`Early return because window is destroyed.`);
return;
}
wc = win.webContents;
}
if (Array.isArray(accelerator) === true) {
accelera... | javascript | {
"resource": ""
} |
q47532 | watchAppearForScrollables | train | function watchAppearForScrollables (tagName, context) {
// when this is a scroller/list/waterfall
if (scrollableTypes.indexOf(tagName) > -1) {
const sd = context.scrollDirection
if (!sd || sd !== 'horizontal') {
appearWatched = context
watchAppear(context, true)
}
}
} | javascript | {
"resource": ""
} |
q47533 | bindEvents | train | function bindEvents (ctx, evts, attrs, tag, appearAttached) {
for (const key in evts) {
const appearEvtName = appearEventsMap[key]
if (appearEvtName) {
attrs[`data-evt-${appearEvtName}`] = ''
if (!appearAttached.value) {
appearAttached.value = true
attrs['weex-appear'] = ''
}... | javascript | {
"resource": ""
} |
q47534 | setRootFont | train | function setRootFont (width, viewportWidth, force) {
const doc = window.document
const rem = width * 750 / viewportWidth / 10
if (!doc.documentElement) { return }
const rootFontSize = doc.documentElement.style.fontSize
if (!rootFontSize || force) {
doc.documentElement.style.fontSize = rem + 'px'
}
inf... | javascript | {
"resource": ""
} |
q47535 | getCommonAncestor | train | function getCommonAncestor(el1, el2) {
var el = el1
while (el) {
if (el.contains(el2) || el == el2) {
return el
}
el = el.parentNode
}
return null
} | javascript | {
"resource": ""
} |
q47536 | fireEvent | train | function fireEvent(element, type, extra) {
var event = doc.createEvent('HTMLEvents')
event.initEvent(type, true, true)
if (typeof extra === 'object') {
for (var p in extra) {
event[p] = extra[p]
}
}
/**
* A flag to distinguish with other events with the same name generated
* by another l... | javascript | {
"resource": ""
} |
q47537 | train | function (key, value, callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
if (!key || (!value && value !== 0)) {
sender.performCallback(callbackId, {
result: 'failed',
data: INVALID_PARAM
})
return
... | javascript | {
"resource": ""
} | |
q47538 | train | function (key, callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
if (!key) {
sender.performCallback(callbackId, {
result: FAILED,
data: INVALID_PARAM
})
return
}
try {
const val = loc... | javascript | {
"resource": ""
} | |
q47539 | train | function (callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
try {
const len = localStorage.length
sender.performCallback(callbackId, {
result: SUCCESS,
data: len
})
}
catch (e) {
// a... | javascript | {
"resource": ""
} | |
q47540 | train | function (callbackId) {
const sender = this.sender
if (!supportLocalStorage) {
return callNotSupportFail(sender, callbackId)
}
try {
const _arr = []
for (let i = 0; i < localStorage.length; i++) {
_arr.push(localStorage.key(i))
}
sender.performCallback(callbackId, {... | javascript | {
"resource": ""
} | |
q47541 | createMouseEvent | train | function createMouseEvent(eventName, originalEvent, finger) {
var e = document.createEvent('MouseEvent');
e.initMouseEvent(eventName, true, true,
originalEvent.view, originalEvent.detail,
finger.x || originalEvent.screenX, finger.y || originalEvent.screenY,
finger.x || originalEvent.clientX, ... | javascript | {
"resource": ""
} |
q47542 | phantomTouchStart | train | function phantomTouchStart(e) {
if (e.synthetic) return;
mouseIsDown = true;
e.preventDefault();
e.stopPropagation();
fireTouchEvents('touchstart', e);
} | javascript | {
"resource": ""
} |
q47543 | moveFingers | train | function moveFingers(e) {
// We'll use this if the second is locked with the first.
var changeX = e.clientX - fingers[0].x || 0;
var changeY = e.clientY - fingers[0].y || 0;
// The first finger just follows the mouse.
fingers[0].move(e.clientX, e.clientY);
// TODO: Determine modifier keys inde... | javascript | {
"resource": ""
} |
q47544 | phantomTouchEnd | train | function phantomTouchEnd(e) {
if (e.synthetic) return;
mouseIsDown = false;
e.preventDefault();
e.stopPropagation();
fireTouchEvents('touchend', e);
fingers.forEach(function(finger) {
if (!finger.target) return;
// Mobile Safari moves all the mouse event to fire after the touche... | javascript | {
"resource": ""
} |
q47545 | phantomKeyUp | train | function phantomKeyUp(e) {
if (e.keyCode === 27) {
if (document.documentElement.classList.contains('_phantom-limb')) {
stop();
} else {
start();
}
}
} | javascript | {
"resource": ""
} |
q47546 | inlineAllStyles | train | function inlineAllStyles(element) {
let styles = getComputedStyle(element);
for(let key in styles) {
if(styles.hasOwnProperty(key)) {
element.style[key] = styles[key];
}
}
for(let i = 0; i < element.childNodes.length; i++) {
let node = element.childNodes[i];
if(node.nodeType === 1) {
... | javascript | {
"resource": ""
} |
q47547 | cut | train | function cut(buffer, size) {
var chunks = [];
var cursor = 0;
do {
var chunkSize = Math.min(size, buffer.length - cursor);
chunks.push(buffer.slice(cursor, cursor + chunkSize));
cursor += chunkSize;
} while(cursor < buffer.length);
return chunks;
} | javascript | {
"resource": ""
} |
q47548 | onRequest | train | function onRequest(request, response) {
var filename = path.join(__dirname, request.url);
// Serving server.js from cache. Useful for microbenchmarks.
if (request.url === cachedUrl) {
if (response.push) {
// Also push down the client js, since it's possible if the requester wants
// one, they wan... | javascript | {
"resource": ""
} |
q47549 | favicon | train | function favicon (path, options) {
var opts = options || {}
var icon // favicon cache
var maxAge = calcMaxAge(opts.maxAge)
if (!path) {
throw new TypeError('path to favicon.ico is required')
}
if (Buffer.isBuffer(path)) {
icon = createIcon(Buffer.from(path), maxAge)
} else if (typeof path === '... | javascript | {
"resource": ""
} |
q47550 | calcMaxAge | train | function calcMaxAge (val) {
var num = typeof val === 'string'
? ms(val)
: val
return num != null
? Math.min(Math.max(0, num), ONE_YEAR_MS)
: ONE_YEAR_MS
} | javascript | {
"resource": ""
} |
q47551 | createIcon | train | function createIcon (buf, maxAge) {
return {
body: buf,
headers: {
'Cache-Control': 'public, max-age=' + Math.floor(maxAge / 1000),
'ETag': etag(buf)
}
}
} | javascript | {
"resource": ""
} |
q47552 | createIsDirError | train | function createIsDirError (path) {
var error = new Error('EISDIR, illegal operation on directory \'' + path + '\'')
error.code = 'EISDIR'
error.errno = 28
error.path = path
error.syscall = 'open'
return error
} | javascript | {
"resource": ""
} |
q47553 | isFresh | train | function isFresh (req, res) {
return fresh(req.headers, {
'etag': res.getHeader('ETag'),
'last-modified': res.getHeader('Last-Modified')
})
} | javascript | {
"resource": ""
} |
q47554 | resolveSync | train | function resolveSync (iconPath) {
var path = resolve(iconPath)
var stat = fs.statSync(path)
if (stat.isDirectory()) {
throw createIsDirError(path)
}
return path
} | javascript | {
"resource": ""
} |
q47555 | metadataMiddleware | train | function metadataMiddleware (options) {
//claimTypes, issuer, pem, endpointPath
options = options || {};
if(!options.issuer) {
throw new Error('options.issuer is required');
}
if(!options.cert) {
throw new Error('options.cert is required');
}
var claimTypes = (options.profileMapper || PassportP... | javascript | {
"resource": ""
} |
q47556 | leftZeroFill | train | function leftZeroFill(number, targetLength) {
var output = number + "";
while (output.length < targetLength){
output = "0" + output;
}
return output;
} | javascript | {
"resource": ""
} |
q47557 | toJalaliFormat | train | function toJalaliFormat(format) {
for (var i = 0; i < format.length; i++) {
if(!i || (format[i-1] !== "j" && format[i-1] !== format[i])) {
if (format[i] === "Y" || format[i] === "M" || format[i] === "D" || format[i] === "g") {
format = format.slice(0, i) + "j" + format.slice(i);
... | javascript | {
"resource": ""
} |
q47558 | normalizeUnits | train | function normalizeUnits(units, momentObj) {
if (isJalali(momentObj)) {
units = toJalaliUnit(units);
}
if (units) {
var lowered = units.toLowerCase();
units = unitAliases[lowered] || lowered;
}
// TODO : add unit test
if (units === "jday") units = "day";
else if (units... | javascript | {
"resource": ""
} |
q47559 | setDate | train | function setDate(momentInstance, year, month, day) {
var d = momentInstance._d;
if (momentInstance._isUTC) {
/*eslint-disable new-cap*/
momentInstance._d = new Date(Date.UTC(year, month, day,
d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds()));
/*e... | javascript | {
"resource": ""
} |
q47560 | findImportedPath | train | function findImportedPath(url, prev, includedFilesMap, includedPaths) {
let candidateFromPaths;
if(prev !== 'stdin') {
const prevPath = path.posix.dirname(prev);
candidateFromPaths = [prevPath, ...includedPaths];
} else {
candidateFromPaths = [...includedPaths];
}
for(let i = 0; i < candidateFro... | javascript | {
"resource": ""
} |
q47561 | getImportAbsolutePath | train | function getImportAbsolutePath(url, prev, includedFilesMap, includedPaths = []) {
// Ensure that both @import 'file' and @import 'file.scss' is mapped correctly
let extension = path.posix.extname(prev);
if(path.posix.extname(url) !== extension) {
url += extension;
}
const absolutePath = findImportedPath(... | javascript | {
"resource": ""
} |
q47562 | getImportResult | train | function getImportResult(extractions, url, prev, includedFilesMap, includedPaths) {
const absolutePath = getImportAbsolutePath(url, prev, includedFilesMap, includedPaths);
const contents = extractions[absolutePath].injectedData;
return { file: absolutePath, contents };
} | javascript | {
"resource": ""
} |
q47563 | getDeclarationDeps | train | function getDeclarationDeps($ast, declaration, scope) {
if(scope !== SCOPE_EXPLICIT) {
return {};
}
const depParentNodes = $ast(declaration).parents(node => {
if(node.node.type === 'mixin') {
return true;
} else if(node.node.type === 'atrule') {
const atruleIdentNode = $ast(node).children... | javascript | {
"resource": ""
} |
q47564 | parseDeclaration | train | function parseDeclaration($ast, declaration, scope) {
const variable = {};
const propertyNode = $ast(declaration)
.children('property');
variable.declarationClean = propertyNode.value();
variable.position = propertyNode.get(0).start;
variable.declaration = `$${variable.declarationClean}`;
variable.exp... | javascript | {
"resource": ""
} |
q47565 | processFile | train | function processFile(idx, count, filename, data, parsedDeclarations, pluggable) {
const declarations = parsedDeclarations.files[filename];
// Inject dependent declaration extraction to last file
const dependentDeclarations = idx === count - 1 ? parsedDeclarations.dependentDeclarations : [];
const variables = { ... | javascript | {
"resource": ""
} |
q47566 | getRenderedStats | train | function getRenderedStats(rendered, compileOptions) {
return {
entryFilename: normalizePath(rendered.stats.entry),
includedFiles: rendered.stats.includedFiles.map(f => normalizePath(makeAbsolute(f))),
includedPaths: (compileOptions.includePaths || []).map(normalizePath),
};
} | javascript | {
"resource": ""
} |
q47567 | makeExtractionCompileOptions | train | function makeExtractionCompileOptions(compileOptions, entryFilename, extractions, importer) {
const extractionCompileOptions = Object.assign({}, compileOptions);
const extractionFunctions = {};
// Copy all extraction function for each file into one object for compilation
Object.keys(extractions).forEach(extrac... | javascript | {
"resource": ""
} |
q47568 | compileExtractionResult | train | function compileExtractionResult(orderedFiles, extractions) {
const extractedVariables = { global: {} };
orderedFiles.map(filename => {
const globalFileVariables = extractions[filename].variables.global;
Object.keys(globalFileVariables).map(variableKey => {
globalFileVariables[variableKey].forEach(e... | javascript | {
"resource": ""
} |
q47569 | isColor | train | function isColor(value) {
return value.r != null
&& value.g != null
&& value.b != null
&& value.a != null
&& value.hex != null;
} | javascript | {
"resource": ""
} |
q47570 | serializeValue | train | function serializeValue(sassValue, isInList) {
switch(sassValue.constructor) {
case sass.types.String:
case sass.types.Boolean:
return `${sassValue.getValue()}`;
case sass.types.Number:
return `${sassValue.getValue()}${sassValue.getUnit()}`;
case sass.types.Color:
return serializeC... | javascript | {
"resource": ""
} |
q47571 | createInjection | train | function createInjection(fileId, categoryPrefix, declaration, idx, declarationResultHandler) {
const fnName = `${FN_PREFIX}_${fileId}_${categoryPrefix}_${declaration.declarationClean}_${idx}`;
const injectedFunction = function(sassValue) {
const value = createStructuredValue(sassValue);
declarationResultHa... | javascript | {
"resource": ""
} |
q47572 | includeRawDataFile | train | function includeRawDataFile(includedFiles, files, entryFilename, data) {
let orderedFiles = includedFiles;
if(entryFilename === RAW_DATA_FILE && data) {
files[RAW_DATA_FILE] = data;
orderedFiles = [...orderedFiles, RAW_DATA_FILE];
} else if(orderedFiles.length > 0) {
orderedFiles = [...orderedFiles.s... | javascript | {
"resource": ""
} |
q47573 | makeValue | train | function makeValue(sassValue) {
switch(sassValue.constructor) {
case sass.types.String:
case sass.types.Boolean:
return { value: sassValue.getValue() };
case sass.types.Number:
return { value: sassValue.getValue(), unit: sassValue.getUnit() };
case sass.types.Color:
const r = Math.... | javascript | {
"resource": ""
} |
q47574 | AssetManager | train | function AssetManager(generator, config, logger, document, renderManager) {
events.EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
this._document = document;
this._metaDataRoot = config["meta-data-root"] || META_PLUGIN_... | javascript | {
"resource": ""
} |
q47575 | RenderManager | train | function RenderManager(generator, config, logger) {
events.EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
this._svgRenderers = {};
this._pixmapRenderers = {};
this._componentsByDocument = {};
this._pe... | javascript | {
"resource": ""
} |
q47576 | _pauseAssetGeneration | train | function _pauseAssetGeneration(id) {
if (_waitingDocuments.hasOwnProperty(id)) {
_canceledDocuments[id] = true;
} else if (_assetManagers.hasOwnProperty(id)) {
_assetManagers[id].stop();
}
} | javascript | {
"resource": ""
} |
q47577 | _handleFileChange | train | function _handleFileChange(id, change) {
// If the filename changed but the saved state didn't change, then the file must have been renamed
if (change.previous && !change.hasOwnProperty("previousSaved")) {
_stopAssetGeneration(id);
_stateManager.deactivate(id);
}
} | javascript | {
"resource": ""
} |
q47578 | _getChangedSettings | train | function _getChangedSettings(settings) {
if (settings && typeof(settings) === "object") {
return _generator.extractDocumentSettings({generatorSettings: settings}, PLUGIN_ID);
}
return null;
} | javascript | {
"resource": ""
} |
q47579 | _handleDocGeneratorSettingsChange | train | function _handleDocGeneratorSettingsChange(id, change) {
var curSettings = _getChangedSettings(change.current),
prevSettings = _getChangedSettings(change.previous),
curEnabled = !!(curSettings && curSettings.enabled),
prevEnabled = !!(prevSettings && prevSettings.enabled);
... | javascript | {
"resource": ""
} |
q47580 | _handleOpenDocumentsChanged | train | function _handleOpenDocumentsChanged(all, opened) {
var open = opened || all;
open.forEach(function (id) {
_documentManager.getDocument(id).done(function (document) {
document.on("generatorSettings", _handleDocGeneratorSettingsChange.bind(undefined, id));
}, func... | javascript | {
"resource": ""
} |
q47581 | _startAssetGeneration | train | function _startAssetGeneration(id) {
if (_waitingDocuments.hasOwnProperty(id)) {
return;
}
var documentPromise = _documentManager.getDocument(id);
_waitingDocuments[id] = documentPromise;
documentPromise.done(function (document) {
delete _waitin... | javascript | {
"resource": ""
} |
q47582 | _getConfig | train | function _getConfig() {
var copy = {},
property;
for (property in _config) {
if (_config.hasOwnProperty(property)) {
copy[property] = _config[property];
}
}
return copy;
} | javascript | {
"resource": ""
} |
q47583 | _setConfig | train | function _setConfig(config, keepExisting) {
var property;
// optionally clean out the existing properties first
if (!keepExisting) {
for (property in _config) {
if (_config.hasOwnProperty(property)) {
delete _config[property];
}
... | javascript | {
"resource": ""
} |
q47584 | init | train | function init(generator, config, logger) {
_generator = generator;
_config = config;
_logger = logger;
_documentManager = new DocumentManager(generator, config, logger);
_stateManager = new StateManager(generator, config, logger, _documentManager);
_renderManager = new R... | javascript | {
"resource": ""
} |
q47585 | BaseRenderer | train | function BaseRenderer(generator, config, logger, document) {
this._generator = generator;
this._document = document;
this._logger = logger;
if (config.hasOwnProperty("use-jpg-encoding")) {
this._useJPGEncoding = config["use-jpg-encoding"];
}
if (config.hasOw... | javascript | {
"resource": ""
} |
q47586 | SVGRenderer | train | function SVGRenderer(generator, config, logger, document) {
BaseRenderer.call(this, generator, config, logger, document);
if (config.hasOwnProperty("svgomg-enabled")) {
this._useSVGOMG = !!config["svgomg-enabled"];
}
} | javascript | {
"resource": ""
} |
q47587 | createSVGRenderer | train | function createSVGRenderer(generator, config, logger, document) {
return new SVGRenderer(generator, config, logger, document);
} | javascript | {
"resource": ""
} |
q47588 | PixmapRenderer | train | function PixmapRenderer(generator, config, logger, document) {
BaseRenderer.call(this, generator, config, logger, document);
if (config.hasOwnProperty("interpolation-type")) {
this._interpolationType = config["interpolation-type"];
}
} | javascript | {
"resource": ""
} |
q47589 | createPixmapRenderer | train | function createPixmapRenderer(generator, config, logger, document) {
return new PixmapRenderer(generator, config, logger, document);
} | javascript | {
"resource": ""
} |
q47590 | _shallowCopy | train | function _shallowCopy(component) {
var clone = {},
property;
for (property in component) {
if (component.hasOwnProperty(property)) {
clone[property] = component[property];
}
}
return clone;
} | javascript | {
"resource": ""
} |
q47591 | _deriveComponent | train | function _deriveComponent(def, basic) {
var derived = _shallowCopy(basic);
if (def.hasOwnProperty("folder")) {
if (derived.hasOwnProperty("folder")) {
var folder = def.folder.concat(basic.folder);
derived.folder = folder;
} else {
... | javascript | {
"resource": ""
} |
q47592 | ComponentManager | train | function ComponentManager(generator, config) {
this._parserManager = new ParserManager(config);
this._config = config || {};
this._allComponents = {};
this._componentsForLayer = {};
this._componentsForComp = {};
this._componentsForDocument = {};
this._paths = {};
... | javascript | {
"resource": ""
} |
q47593 | ParserManager | train | function ParserManager(config) {
this._config = config || {};
this._supportedUnits = {
"in": true,
"cm": true,
"px": true,
"mm": true
};
this._supportedExtensions = {
"jpg": true,
"png": true,
"gif": tr... | javascript | {
"resource": ""
} |
q47594 | FileManager | train | function FileManager(generator, config, logger) {
this._generator = generator;
this._config = config;
this._logger = logger;
this._queue = new AsyncQueue();
this._queue.pause();
this._queue.on("error", function (err) {
this._logger.error(err);
}.bind(... | javascript | {
"resource": ""
} |
q47595 | DocumentManager | train | function DocumentManager(generator, config, logger, options) {
EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
options = options || {};
this._getDocumentInfoFlags = options.getDocumentInfoFlags;
... | javascript | {
"resource": ""
} |
q47596 | Document | train | function Document(generator, config, logger, raw) {
if (DEBUG_TO_RAW_CONVERSION) {
debugLogObject("raw", raw);
}
events.EventEmitter.call(this);
this._generator = generator;
this._config = config;
this._logger = logger;
var property;
... | javascript | {
"resource": ""
} |
q47597 | BaseLayer | train | function BaseLayer(document, group, raw) {
this._document = document;
this._logger = document._logger;
if (group) {
this._setGroup(group);
}
var handledProperties = this._handledProperties || {},
property;
for (property in raw) {
if ... | javascript | {
"resource": ""
} |
q47598 | createLayer | train | function createLayer(document, parent, rawLayer) {
if (!parent && !rawLayer.hasOwnProperty("type")) {
return new LayerGroup(document, null, rawLayer);
}
switch (rawLayer.type) {
case "layerSection":
case "artboardSection":
case "framedGroupSection":
... | javascript | {
"resource": ""
} |
q47599 | getAframeElementsFromSceneStructure | train | function getAframeElementsFromSceneStructure(sceneStructure, parent) {
var collection = parent ? null : [] // use collection or parent
sceneStructure.forEach(function(element3d) {
// check if type is supported in aframe
if (validTypes.indexOf(element3d.type) > -1) {
// get html attributes from element... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.