_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
language
stringclasses
1 value
meta_information
dict
q28500
resolveNative
train
function resolveNative(success, fail, path, fsType, options, size) { window.webkitRequestFileSystem( fsType, size, function (fs) { if (path === '') { //no path provided, call success with root file system success(createEntryFromNative(fs.root)); ...
javascript
{ "resource": "" }
q28501
train
function (pattern, repeat) { repeat = (typeof repeat !== 'undefined') ? repeat : -1; pattern = pattern.unshift(0); // add a 0 at beginning for backwards compatibility
javascript
{ "resource": "" }
q28502
read
train
function read(context) { const projectRoot = getProjectRoot(context); const configXml = getConfigXml(projectRoot); const branchXml = getBranchXml(configXml); const branchPreferences = getBranchPreferences( context,
javascript
{ "resource": "" }
q28503
getConfigXml
train
function getConfigXml(projectRoot) { const pathToConfigXml = path.join(projectRoot, "config.xml"); const configXml = xmlHelper.readXmlAsJson(pathToConfigXml);
javascript
{ "resource": "" }
q28504
getProjectName
train
function getProjectName(configXml) { let output = null; if (configXml.widget.hasOwnProperty("name")) { const name = configXml.widget.name[0]; if (typeof name === "string") { // handle <name>Branch Cordova</name> output = configXml.widget.name[0]; } else {
javascript
{ "resource": "" }
q28505
getProjectModule
train
function getProjectModule(context) { const projectRoot = getProjectRoot(context); const projectPath = path.join(projectRoot, "platforms", "ios"); try { // pre 5.0 cordova structure return context .requireCordovaModule("cordova-lib/src/plugman/platforms") .ios.parseProjectFile(pr...
javascript
{ "resource": "" }
q28506
updateNpmVersion
train
function updateNpmVersion(pluginConfig, config, callback) { const files = readFilePaths(FILES); const version = config.nextRelease.version; let git = ""; for (let i = 0; i < files.length; i++) { // update const file = files[i]; const content = readContent(file); const
javascript
{ "resource": "" }
q28507
updateVersion
train
function updateVersion(file, content, version) { const prev = /id="branch-cordova-sdk"[\s]*version="\d+\.\d+\.\d+"/gim; const next = `id="branch-cordova-sdk"\n version="${version}"`; try { if (isFileXml(file)) { content = content.replace(prev, next); } else { isChange = content...
javascript
{ "resource": "" }
q28508
readFilePaths
train
function readFilePaths(files) { const locations = []; for (let i = 0; i < files.length; i++) { const file = files[i]; const location =
javascript
{ "resource": "" }
q28509
commitChanges
train
function commitChanges(git, version) { git += `git commit -m "chore: updated npm version to ${version}" && git push`; exec(git, (err, stdout, stderr) => { if (err) { throw new Error( "BRANCH
javascript
{ "resource": "" }
q28510
registerComponent
train
function registerComponent(Vue, name, definition) { Vue._shards_vue_components_ = Vue._shards_vue_components_ || {}; var loaded = Vue._shards_vue_components_[name]; if (!loaded && definition && name) {
javascript
{ "resource": "" }
q28511
registerComponents
train
function registerComponents(Vue, components) { for (var component in
javascript
{ "resource": "" }
q28512
registerDirective
train
function registerDirective(Vue, name, definition) { Vue._shards_vue_directives_ = Vue._shards_vue_directives_ || {}; var loaded = Vue._shards_vue_directives_[name]; if (!loaded && definition && name) {
javascript
{ "resource": "" }
q28513
registerDirectives
train
function registerDirectives(Vue, directives) { for (var directive in
javascript
{ "resource": "" }
q28514
train
function (el, className) { if (className && isElement(el)) {
javascript
{ "resource": "" }
q28515
train
function (el, attr, value) { if (attr && isElement(el)) {
javascript
{ "resource": "" }
q28516
train
function (el) { return !isElement(el) || el.disabled || el.classList.contains('disabled')
javascript
{ "resource": "" }
q28517
train
function (el) { return isElement(el) && document.body.contains(el)
javascript
{ "resource": "" }
q28518
train
function (selector, root) { if (!isElement(root)) { root = document;
javascript
{ "resource": "" }
q28519
train
function (selector, root) { if (!isElement(root)) { return null } var Closest = Element.prototype.closest || function (sel) { var element = this; if (!document.documentElement.contains(element)) { return null ...
javascript
{ "resource": "" }
q28520
train
function (type, breakpoint, val) { if (!!val === false) { return false } var className = type; if (breakpoint) { className += "-" + (breakpoint.replace(type, '')); // -md ? } if (type === 'col' && (val === '' ||
javascript
{ "resource": "" }
q28521
generateProp
train
function generateProp(type, defaultVal) { if ( type === void 0 ) type = [Boolean, String, Number]; if ( defaultVal === void 0 ) defaultVal = null;
javascript
{ "resource": "" }
q28522
createBreakpointMap
train
function createBreakpointMap(propGenArgs, defaultValue, breakpointWrapper) { if ( propGenArgs === void 0 ) propGenArgs = null; if ( breakpointWrapper === void 0 ) breakpointWrapper = null; var breakpointWrapperArgs = [], len = arguments.length - 3; while ( len-- > 0 ) breakpointWrapperAr...
javascript
{ "resource": "" }
q28523
CancelableEvent
train
function CancelableEvent (type, eventInit) { if ( eventInit === void 0 ) eventInit = {}; Object.assign(this, CancelableEvent.defaults(), eventInit, { type: type }); Object.defineProperties(this, { type: _makeCancelableEventProps(), cancelable: _makeCancelableEventProps(...
javascript
{ "resource": "" }
q28524
train
function () { if (this$1._config.animation) { var initConfigAnimation = this$1._config.animation || false; if (getAttr(TPElement, 'x-placement') !== null) { return } removeClass(TPElement, TP_STATE_CLASSES.FADE...
javascript
{ "resource": "" }
q28525
DOMObserver
train
function DOMObserver (el, callback, opts) { if ( opts === void 0 ) opts = null; if (opts === null) { opts = { subtree: true, childList: true, characterData: true, attributes: true, attributeFilter: ['class', 's...
javascript
{ "resource": "" }
q28526
getUpdatedConfig
train
function getUpdatedConfig() { var updatedConfig = Object.assign({}, this.baseConfig); // override title if slot is used if (this.$refs.title) { updatedConfig.title = this.$refs.title; updatedConfig.html = true; } ...
javascript
{ "resource": "" }
q28527
parseBindings
train
function parseBindings(bindings) { var config = {}; switch (typeof bindings.value) { case 'string': case 'function': config.title = bindings.value; break case 'object': config = Object.assign({}, bindings.value); ...
javascript
{ "resource": "" }
q28528
mergeDefaultOptions
train
function mergeDefaultOptions(opts) { const copy = {}; copyKeys(copy, _defaultOptions); copyKeys(copy, opts); Object.keys(_defaultOptions).forEach((key) => { const obj = _defaultOptions[key]; if (typeof obj === 'object') {
javascript
{ "resource": "" }
q28529
parseAttribute
train
function parseAttribute(attribute, defaultValue) { // 1em, 1.0em, 0.1em, .1em, 1. em const re = /^(-{0,1}\.{0,1}\d+(\.\d+)?)[\s|\.]*(\w*)$/; if (attribute && re.test(attribute)) { const match = re.exec(attribute); const number = match[1]; const units = match[3] || 'px';
javascript
{ "resource": "" }
q28530
setHTML
train
function setHTML(container, content) { if (container) { // Clear out everything in the container while (container.firstChild) { container.removeChild(container.firstChild); } if (content) { if (typeof content ===
javascript
{ "resource": "" }
q28531
toLatLng
train
function toLatLng(v) { if (v !== undefined && v !== null) { if (v instanceof google.maps.LatLng) { return v;
javascript
{ "resource": "" }
q28532
applyCss
train
function applyCss(element, args) { if (element && args) { for (var i = 0; i < args.length; i++) { var className = args[i]; if (className) { if (element.className) { ...
javascript
{ "resource": "" }
q28533
blueRadiosAT
train
function blueRadiosAT(command){ if (! wsclient.listeners('notification').length) { console.log('subscribe to RX notification'); //listen for notification response wsclient.on('notification', function(peripheralId, serviceUuid, characteristicUuid, data) { // console.log("NOTIFICATION: " + data.toString('hex') +...
javascript
{ "resource": "" }
q28534
dumpLog
train
function dumpLog(type, peripheralId, serviceUuid, uuid, data ){ var dumpFile=dumpPath + '/' + peripheralId + '.log'; if (servicesLookup[serviceUuid]) { var serviceName = servicesLookup[serviceUuid].name; var characteristicName = servicesLookup[serviceUuid].characteristics[uuid].name;
javascript
{ "resource": "" }
q28535
formatUuid
train
function formatUuid(Uuid) { var formatted=''; //expand short service/characteristic UUID if (Uuid.length == 4) { formatted='0000' + Uuid +
javascript
{ "resource": "" }
q28536
lockCrc
train
function lockCrc(inputStr){ res = 0xff; inputHex = new Buffer(inputStr,'hex'); //start from the second byte for (i = 1; i<= inputHex.length; i++) { res = res ^ inputHex[i]; }
javascript
{ "resource": "" }
q28537
checkFile
train
function checkFile(peripheralId, callback) { if (overWriteServices) { callback(false); } else { fs.stat(devicesPath + '/' + peripheralId + '.srv.json', function(err, stat) { if(err == null) {
javascript
{ "resource": "" }
q28538
readRaw
train
function readRaw(peripheralId, serviceUuid, uuid, callback){ //todo catch exceptions var handle = servicesCache[peripheralId].services[serviceUuid].characteristics[uuid].handle; var peripheral = peripherals[peripheralId]; //if not connected, connect checkConnected(peripheral, function(){ peripheral.readH...
javascript
{ "resource": "" }
q28539
writeRaw
train
function writeRaw(peripheralId, serviceUuid, uuid, data, withoutResponse, callback){ //todo catch exceptions var handle = servicesCache[peripheralId].services[serviceUuid].characteristics[uuid].handle; var peripheral = peripherals[peripheralId]; //if not connected, connect checkConnected(peripheral, function...
javascript
{ "resource": "" }
q28540
checkConnected
train
function checkConnected(peripheral, callback){ if (peripheral.state === 'connected') { debug(' - connected'); if (callback) { callback(); } } else if (peripheral.state === 'connecting'){ debug(' - connecting....'); //wait until the connection completes, invoke callback peripheral.once('conne...
javascript
{ "resource": "" }
q28541
index
train
function index(a, fn) { let i, l; for (i = 0, l = a.length; i < l; i++) {
javascript
{ "resource": "" }
q28542
slice
train
function slice(array) { const newArray = new Array(array.length); let i, l; for (i = 0, l = array.length;
javascript
{ "resource": "" }
q28543
cloneRegexp
train
function cloneRegexp(re) { const pattern = re.source; let flags = ''; if (re.global) flags += 'g'; if (re.multiline)
javascript
{ "resource": "" }
q28544
cloner
train
function cloner(deep, item) { if (!item || typeof item !== 'object' || item instanceof Error || item instanceof MonkeyDefinition || item instanceof Monkey || ('ArrayBuffer' in global && item instanceof ArrayBuffer)) return item; // Array if (type.array(item)) { if (deep) { ...
javascript
{ "resource": "" }
q28545
compare
train
function compare(object, description) { let ok = true, k; // If we reached here via a recursive call, object may be undefined because // not all items in a collection will have the same deep nesting structure. if (!object) return false; for (k in description) { if (type.object(description[k]))...
javascript
{ "resource": "" }
q28546
freezer
train
function freezer(deep, o) { if (typeof o !== 'object' || o === null || o instanceof Monkey) return; Object.freeze(o); if (!deep) return; if (Array.isArray(o)) { // Iterating through the elements let i, l; for (i = 0, l = o.length; i < l; i++) deepFreeze(o[i]); ...
javascript
{ "resource": "" }
q28547
makeSetter
train
function makeSetter(name, typeChecker) { /** * Binding a setter method to the Cursor class and having the following * definition. * * Note: this is not really possible to make those setters variadic because * it would create an impossible polymorphism with path. * * @todo: perform value validati...
javascript
{ "resource": "" }
q28548
extendData
train
function extendData({ data, lengthAngle: totalAngle, totalValue, paddingAngle, }) { const total = totalValue || sumValues(data); const normalizedTotalAngle = valueBetween(totalAngle, -360, 360); const numberOfPaddings = Math.abs(normalizedTotalAngle) === 360 ? data.length : data.length - 1; const de...
javascript
{ "resource": "" }
q28549
train
function(req, res, next) { if (req.headers.accept && req.headers.accept.startsWith('text/html')) {
javascript
{ "resource": "" }
q28550
showPreset
train
function showPreset(name, pos){ console.log(_colors.magenta('Preset: ' + name)); // create a new progress bar with preset var bar = new _progress.Bar({ align: pos }, _progress.Presets[name] || _progress.Presets.legacy);
javascript
{ "resource": "" }
q28551
getDateTime
train
function getDateTime(obj) { // get date, hour, minute, second, year, month and day var date = new Date() , hour = date.getHours() , min = date.getMinutes() , sec = date.getSeconds() , year = date.getFullYear() , month = date.getMonth() + 1 , day = date.getDate() ; ...
javascript
{ "resource": "" }
q28552
Openfile
train
function Openfile(i, path) { // !Optimized: use child_process module to open local file with local path (function() { var cmdArr = [ 'nautilus ' + path , 'start "" "' + path + '"' , 'konqueror ' + path , 'o...
javascript
{ "resource": "" }
q28553
parseGroupValue
train
function parseGroupValue(code, value) { if(code <= 9) return value; if(code >= 10 && code <= 59) return parseFloat(value); if(code >= 60 && code <= 99) return parseInt(value); if(code >= 100 && code <= 109) return value; if(code >= 110 && code <= 149) return parseFloat(value); if(code >= 160 && code <= 179) retur...
javascript
{ "resource": "" }
q28554
getExtraTasks
train
async function getExtraTasks() { config = config || (await getConfig()); switch (config.env) { case 'pl': extraTasks.patternLab = require('./pattern-lab-tasks'); break; case 'static': extraTasks.static = require('./static-tasks'); break; case 'pwa': delete require.cache[re...
javascript
{ "resource": "" }
q28555
getFileHash
train
function getFileHash(filePath, callback) { var stream = fs.ReadStream(filePath); var md5sum = crypto.createHash('md5'); stream.on('data', function(data) {
javascript
{ "resource": "" }
q28556
mkDirs
train
async function mkDirs() { config = config || (await getConfig()); try { return Promise.all([ config.wwwDir ? mkdirp(config.wwwDir) : null, config.dataDir ? mkdirp(config.dataDir) : null, config.buildDir
javascript
{ "resource": "" }
q28557
setupServer
train
async function setupServer() { return new Promise(async (resolve, reject) => { config = config || (await getConfig()); config.components.individual = []; config.prod = true; config.enableCache = true; config.mode = 'server'; config.env = 'pwa'; config.sourceMaps = false; config.copy = ...
javascript
{ "resource": "" }
q28558
receiveIframeMessage
train
function receiveIframeMessage(event) { // does the origin sending the message match the current host? if not dev/null the request if ( window.location.protocol !== 'file:' && event.origin !== window.location.protocol + '//' + window.location.host ) { return; } let path; let data = {}; try { ...
javascript
{ "resource": "" }
q28559
buildWebpackEntry
train
async function buildWebpackEntry() { const { components } = await getBoltManifest(); const entry = {}; const globalEntryName = 'bolt-global'; if (components.global) { entry[globalEntryName] = []; components.global.forEach(component => { if (component.assets.style) { entry...
javascript
{ "resource": "" }
q28560
readYamlFile
train
function readYamlFile(file) { return new Promise((resolve, reject) => {
javascript
{ "resource": "" }
q28561
writeYamlFile
train
function writeYamlFile(file, data) { return new Promise((resolve, reject) => { writeFile(file, toYaml(data))
javascript
{ "resource": "" }
q28562
generatePackageData
train
async function generatePackageData() { boltPackages.forEach(async pkg => { if (pkg.version !== '0.0.0' && pkg.private !== true) { const name = pkg.name; try { const pkgInfo = await packageJson(name, { allVersions: true, }); processedPackages.push(pkgInfo); nu...
javascript
{ "resource": "" }
q28563
getPage
train
async function getPage(file) { config = config || (await asyncConfig()); if (config.verbosity > 3) { log.dim(`Getting info for: ${file}`); } const url = path .relative(config.srcDir, file) .replace('.md', '.html') .split('/') .map(x => x.replace(/^[0-9]*-/, '')) // Removing number prefix `0...
javascript
{ "resource": "" }
q28564
getPages
train
async function getPages(srcDir) { config = config || (await asyncConfig()); /** @type Array<String> */ const allPaths = await globby([ path.join(srcDir, '**/*.{md,html}'), '!**/_*/**/*.{md,html}', '!**/pattern-lab/**/*', '!**/_*.{md,html}', ]); return Promise.all(allPaths.map(getPage)).then(p...
javascript
{ "resource": "" }
q28565
getSiteData
train
async function getSiteData(pages) { config = config || (await asyncConfig()); const nestedPages = await getNestedPages(config.srcDir);
javascript
{ "resource": "" }
q28566
compile
train
async function compile(exitOnError = true) { config = config || (await asyncConfig()); const startMessage = chalk.blue('Compiling Static Site...'); const startTime = timer.start(); let spinner; if (config.verbosity > 2) { console.log(startMessage); } else { spinner = ora(startMessage).start(); } ...
javascript
{ "resource": "" }
q28567
init
train
async function init(keepAlive = false) { state = STATES.STARTING; const config = await getConfig(); const relativeFrom = path.dirname(config.configFileUsed); // console.log({ config }); twigNamespaces = await getTwigNamespaceConfig( relativeFrom, config.extraTwigNamespaces, ); twigRenderer = new T...
javascript
{ "resource": "" }
q28568
render
train
async function render(template, data = {}, keepAlive = false) { await
javascript
{ "resource": "" }
q28569
renderString
train
async function renderString(templateString, data = {}, keepAlive = false) { await prep(keepAlive); const results
javascript
{ "resource": "" }
q28570
uniqueArray
train
function uniqueArray(item) { const u = {}; const newArray = []; for (let i = 0, l = item.length; i < l; ++i) { if (!{}.hasOwnProperty.call(u, item[i])) {
javascript
{ "resource": "" }
q28571
ensureFileExists
train
function ensureFileExists(filePath) { fs.access(filePath, err => { if (err) { log.errorAndExit( 'This file ^^^ does not exist and it was
javascript
{ "resource": "" }
q28572
dirExists
train
async function dirExists(path) { try { const stats = await stat(path);
javascript
{ "resource": "" }
q28573
execAndReport
train
async function execAndReport({ cmd, name }) { try { const { failed, // code, // timedOut, stdout, stderr, // message, } = await execa.shell(cmd); process.stdout.write(stdout); process.stderr.write(stderr); await setCheckRun({ name, status: 'completed...
javascript
{ "resource": "" }
q28574
sh
train
async function sh( cmd, args, exitOnError, streamOutput, showCmdOnError = true, exitImmediately = false, ) { return new Promise((resolve, reject) => { const child = execa(cmd, args); let output = ''; if (streamOutput) { child.stdout.pipe(process.stdout); child.stderr.pipe(process....
javascript
{ "resource": "" }
q28575
addNestedLevelProps
train
function addNestedLevelProps(childNode, level) { let currentLevel = level; if (childNode.tagName) {
javascript
{ "resource": "" }
q28576
updateConfig
train
async function updateConfig(options, programInstance) { await configStore.updateConfig(config => { originalConfig = config; config.verbosity = typeof program.verbosity === 'undefined' ? config.verbosity : program.verbosity; config.openServerAtStart = ...
javascript
{ "resource": "" }
q28577
translateColor
train
function translateColor(colorArr, variationName, execMode) { const [colorVar, alpha] = colorArr; // returns the real color representation if (!options.palette) { options.palette = getColorPalette(); } const underlineColor = options.palette[variationName][colorVar]; if (!underlineColor) { // varia...
javascript
{ "resource": "" }
q28578
processRules
train
function processRules(root) { root.walkRules(rule => { if (!hasThemify(rule.toString())) { return; } let aggragatedSelectorsMap = {}; let aggragatedSelectors = []; let createdRules = []; const variationRules = { [defaultVariation]: rule, }; rule.walkDecls(decl => { ...
javascript
{ "resource": "" }
q28579
createRuleWithVariation
train
function createRuleWithVariation(rule, variationName) { const
javascript
{ "resource": "" }
q28580
createFallbackRuleWithVariation
train
function createFallbackRuleWithVariation(rule, variationName) { const selector = getSelectorName(rule, variationName,
javascript
{ "resource": "" }
q28581
getSelectorName
train
function getSelectorName(rule, variationName, isFallbackSelector = false) { const selectorPrefix = `.${options.classPrefix || ''}${variationName}`; // console.log(variationName); if (isFallbackSelector) { return rule.selectors .map(selector => { let selectors = []; let initialSelector ...
javascript
{ "resource": "" }
q28582
errorAndExit
train
function errorAndExit(msg, logMe) { // @todo Only trigger if `verbosity > 1` if (logMe) { // Adding some empty lines before error message for readability console.log(); console.log(); console.log(logMe); } error(`Error: ${msg}`); // There's a few ways to handle exiting // This is suggested...
javascript
{ "resource": "" }
q28583
activateGumshoeLink
train
function activateGumshoeLink() { const originalTarget = nav.nav; let originalTargetHref; let normalizedTarget; if (originalTarget) { originalTargetHref = originalTarget.getAttribute('href'); } else { originalTargetHref = nav.nav.ge...
javascript
{ "resource": "" }
q28584
flattenDeep
train
function flattenDeep(arr1) { return arr1.reduce( (acc, val) => Array.isArray(val) ?
javascript
{ "resource": "" }
q28585
aggregateBoltDependencies
train
async function aggregateBoltDependencies(data) { let componentDependencies = []; let componentsWithoutDeps = data; componentsWithoutDeps.forEach(item => { if (item.deps) { componentDependencies.push([...item.deps]); } }); componentDependencies = flattenDeep(componentDependencies); component...
javascript
{ "resource": "" }
q28586
getAllDirs
train
async function getAllDirs(relativeFrom) { const dirs = []; const manifest = await getBoltManifest(); [manifest.components.global, manifest.components.individual].forEach( componentList => { componentList.forEach(component => { dirs.push( relativeFrom
javascript
{ "resource": "" }
q28587
getTwigNamespaceConfig
train
async function getTwigNamespaceConfig(relativeFrom, extraNamespaces = {}) { const config = await getConfig(); const namespaces = {}; const allDirs = []; const manifest = await getBoltManifest(); const global = manifest.components.global; const individual = manifest.components.individual; [global, individ...
javascript
{ "resource": "" }
q28588
Socket
train
function Socket(options) { if (!(this instanceof Socket)) { return new Socket(options); } var tty = process.binding('tty_wrap');
javascript
{ "resource": "" }
q28589
Agent
train
function Agent(file, args, env, cwd, cols, rows, debug) { var self = this; // Increment the number of pipes created. pipeIncr++; // Unique identifier per pipe created. var timestamp = Date.now(); // The data pipe is the direct connection to the forked terminal. this.dataPipe = '\\\\.\\pipe\\winpty-data...
javascript
{ "resource": "" }
q28590
isWildcardRange
train
function isWildcardRange(range, constraints) { if (range instanceof Array && !range.length) { return false; } if (constraints.length !== 2) { return false;
javascript
{ "resource": "" }
q28591
CronExpression
train
function CronExpression (fields, options) { this._options = options; this._utc = options.utc || false; this._tz = this._utc ? 'UTC' : options.tz; this._currentDate = new CronDate(options.currentDate, this._tz); this._startDate = options.startDate ? new CronDate(options.startDate, this._tz) : null; this._end...
javascript
{ "resource": "" }
q28592
parseRepeat
train
function parseRepeat (val) { var repeatInterval = 1; var atoms = val.split('/'); if (atoms.length > 1) {
javascript
{ "resource": "" }
q28593
matchSchedule
train
function matchSchedule (value, sequence) { for (var i = 0, c = sequence.length; i < c; i++) { if (sequence[i] >= value) {
javascript
{ "resource": "" }
q28594
isNthDayMatch
train
function isNthDayMatch(date, nthDayOfWeek) { if (nthDayOfWeek < 6) { if ( date.getDate() < 8 && nthDayOfWeek === 1 // First occurence has to happen in first 7 days of the month ) { return true; } var offset = date.getDate() % 7 ? 1 : 0; // Math is off by 1 when dayOf...
javascript
{ "resource": "" }
q28595
train
function(){ // Update the next frame updateId = requestAnimationFrame(update); var now = Date.now(); if (emitter) emitter.update((now - elapsed) * 0.001); framerate.innerHTML = (1000 / (now - elapsed)).toFixed(2); elapsed
javascript
{ "resource": "" }
q28596
train
function(a, b) { a = a.trim().toLowerCase(); b = b.trim().toLowerCase(); if (a === b)
javascript
{ "resource": "" }
q28597
train
function(sort, antiStabilize) { return function(a, b) { var unstableResult = sort(a.td, b.td); if (unstableResult === 0) { if (antiStabilize) return b.index
javascript
{ "resource": "" }
q28598
extendContext
train
function extendContext(context, opts) { Object.defineProperties(context, { [CONTEXT_SESSION]: { get() { if (this[_CONTEXT_SESSION]) return this[_CONTEXT_SESSION]; this[_CONTEXT_SESSION] = new ContextSession(this, opts); return this[_CONTEXT_SESSION];
javascript
{ "resource": "" }
q28599
Router
train
function Router(opts) { if (!(this instanceof Router)) { return new Router(opts); } this.opts = opts || {}; this.methods = this.opts.methods || [ 'HEAD', 'OPTIONS',
javascript
{ "resource": "" }