_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q46500
_convertDetails
train
function _convertDetails(type, details) { var convertedDetails = {} for (var data in details) { const string = type + '[' + data + ']'; convertedDetails[string] = details[data]; } return convertedDetails; }
javascript
{ "resource": "" }
q46501
_parseJSON
train
async function _parseJSON(token) { if (token._bodyInit == null) { return token; } else { const body = await token.json(); return body; } }
javascript
{ "resource": "" }
q46502
highlightMatches
train
function highlightMatches(chunks) { return $.map(chunks, function (chunk) { var text = utils.escapeHtml(chunk.text); if (text && chunk.matched) { text = '<strong>' + text + '</strong>'; } return text; }).join(''); }
javascript
{ "resource": "" }
q46503
train
function (origin, elLayout) { var that = this, scrollLeft = that.$viewport.scrollLeft(), style; if (that.isMobile) { style = that.options.floating ? { left: scrollLeft + 'px', top: elLayout.top + elLayout.outerHeight + 'px' ...
javascript
{ "resource": "" }
q46504
train
function () { var that = this; return that.suggestions.length > 1 || (that.suggestions.length === 1 && (!that.selection || $.trim(that.suggestions[0].value) !== $.trim(that.selection.value)) ); }
javascript
{ "resource": "" }
q46505
train
function () { var that = this; that.uniqueId = utils.uniqueId('i'); that.createWrapper(); that.notify('initialize'); that.bindWindowEvents(); that.setOptions(); that.fixPosition(); }
javascript
{ "resource": "" }
q46506
train
function () { var that = this, events = 'mouseover focus keydown', timer, callback = function () { that.initializer.resolve(); that.enable(); }; that.initializer.always(function(){ that.el.off(events, callback);...
javascript
{ "resource": "" }
q46507
train
function (e) { var that = this, elLayout = {}, wrapperOffset, origin; that.isMobile = that.$viewport.width() <= that.options.mobileWidth; if (!that.isInitialized() || (e && e.type == 'scroll' && !(that.options.floating || that.isMobile))) return; tha...
javascript
{ "resource": "" }
q46508
train
function () { var that = this, fullQuery = that.extendedCurrentValue(), currentValue = that.el.val(), resolver = $.Deferred(); resolver .done(function (suggestion) { that.selectSuggestion(suggestion, 0, currentValue, { hasBeenEnriched: tru...
javascript
{ "resource": "" }
q46509
train
function () { var that = this, parentInstance = that.getParentInstance(), parentValue = parentInstance && parentInstance.extendedCurrentValue(), currentValue = $.trim(that.el.val()); return utils.compact([parentValue, currentValue]).join(' '); }
javascript
{ "resource": "" }
q46510
train
function (query, customParams, requestOptions) { var response, that = this, options = that.options, noCallbacks = requestOptions && requestOptions.noCallbacks, useEnrichmentCache = requestOptions && requestOptions.useEnrichmentCache, method = requestOp...
javascript
{ "resource": "" }
q46511
train
function (params, method) { var that = this, request = $.ajax( that.getAjaxParams(method, { data: utils.serialize(params) }) ); that.abortRequest(); that.currentRequest = request; that.notify('request'); request.always(function () { ...
javascript
{ "resource": "" }
q46512
train
function (response) { var that = this, suggestions; if (!response || !$.isArray(response.suggestions)) { return false; } that.verifySuggestionsFormat(response.suggestions); that.setUnrestrictedValues(response.suggestions); if ($.isFunction(that....
javascript
{ "resource": "" }
q46513
train
function (suggestion, selectionOptions) { var that = this, formatSelected = that.options.formatSelected || that.type.formatSelected, hasSameValues = selectionOptions && selectionOptions.hasSameValues, hasBeenEnriched = selectionOptions && selectionOptions.hasBeenEnriched, ...
javascript
{ "resource": "" }
q46514
train
function (suggestions) { var that = this, shouldRestrict = that.shouldRestrictValues(), label = that.getFirstConstraintLabel(); $.each(suggestions, function (i, suggestion) { if (!suggestion.unrestricted_value) { suggestion.unrestricted_value = should...
javascript
{ "resource": "" }
q46515
sameParentChecker
train
function sameParentChecker (preprocessFn) { return function (suggestions) { if (suggestions.length === 0) { return false; } if (suggestions.length === 1) { return true; } var parentValue = preprocessFn(suggestions[0].value), aliens = sugge...
javascript
{ "resource": "" }
q46516
belongsToArea
train
function belongsToArea(suggestion, instance){ var parentSuggestion = instance.selection, result = parentSuggestion && parentSuggestion.data && instance.bounds; if (result) { collection_util.each(instance.bounds.all, function (bound, i) { return (result = parentSuggestion.data[bound]...
javascript
{ "resource": "" }
q46517
train
function (data) { var that = this, restrictedKeys = [], unrestrictedData = {}, maxSpecificity = -1; // Find most specific location that could restrict current data collection_util.each(that.constraints, function (constraint, id) { collection_util....
javascript
{ "resource": "" }
q46518
setAlternateAngular
train
function setAlternateAngular() { // This method cannot be called more than once if (alt_angular) { throw new Error('setAlternateAngular can only be called once.'); } else { alt_angular = {}; } // Make sure that bootstrap has been called checkBoots...
javascript
{ "resource": "" }
q46519
applyBasePath
train
function applyBasePath(search) { if (_.isUndefined(config.basePath)) { return search; } var modifyKeys = ['Bucket', 'CopySource']; var ret = _.mapObject(search, function (value, key) { if (_.indexOf(modifyKeys, key) === -1) { return value; } else { return config.basePath + '/' + value; } }) re...
javascript
{ "resource": "" }
q46520
S3Mock
train
function S3Mock(options) { if (!_.isUndefined(options) && !_.isUndefined(options.params)) { this.defaultOptions = _.extend({}, applyBasePath(options.params)); } this.config = { update: function() {} }; }
javascript
{ "resource": "" }
q46521
train
function(params, callback) { var err = null; if (typeof(params) === "object" && params !== null) { if(typeof(params.Bucket) !== "string" || params.Bucket.length <= 0) { err = new Error("Mock-AWS-S3: Argument 'params' must contain a 'Bucket' (String) prope...
javascript
{ "resource": "" }
q46522
CRC8
train
function CRC8(polynomial) { // constructor takes an optional polynomial type from CRC8.POLY if (polynomial == null) polynomial = CRC8.POLY.CRC8_CCITT //if (polynomial == null) polynomial = CRC8.POLY.CRC8_DALLAS_MAXIM this.table = CRC8.generateTable(polynomial); }
javascript
{ "resource": "" }
q46523
createElements
train
function createElements(tagName, attrs, children) { const element = isSVG(tagName) ? document.createElementNS('http://www.w3.org/2000/svg', tagName) : document.createElement(tagName) // one or multiple will be evaluated to append as string or HTMLElement const fragment = createFragmentFrom(children) el...
javascript
{ "resource": "" }
q46524
composeToFunction
train
function composeToFunction(JSXTag, elementProps, children) { const props = Object.assign({}, JSXTag.defaultProps || {}, elementProps, { children }) const bridge = JSXTag.prototype.render ? new JSXTag(props).render : JSXTag const result = bridge(props) switch (result) { case 'FRAGMENT': return createF...
javascript
{ "resource": "" }
q46525
versionRelease
train
function versionRelease(version) { return new Promise((resolve, reject) => { const [pkgPath, pkg] = getPackageObject(); const bumpVersion = (version, isReleaseType, throwOnEqual) => { const newVersion = isReleaseType ? semver.inc(pkg.version, version) : semver.valid(version); ...
javascript
{ "resource": "" }
q46526
cutRelease
train
function cutRelease(releaseNote) { const [pkgPath, pkg] = getPackageObject(); const msg = getCommitTagMessage(pkg.version); return updateChangelogInternal(pkg.version, releaseNote) // Stage and commit all new, modified, and deleted files in the entire working directory .then(() => runCommand...
javascript
{ "resource": "" }
q46527
publishRelease
train
function publishRelease(npmDistTag) { const tag = npmDistTag || "latest"; const distPath = path.resolve(process.cwd(), "dist"); const distFolders = []; const asyncInSeries = (items, asyncFunc) => { return new Promise((resolve, reject) => { const series = index => { i...
javascript
{ "resource": "" }
q46528
runCommand
train
function runCommand(command) { return new Promise((resolve, reject) => { utils.logInfo(`Command: ${command}`); childProcess.exec(command, (error, stdout, stderr) => { // If exec returns content in stderr, but no error, print it as a warning. // If exec returns an error, rejec...
javascript
{ "resource": "" }
q46529
clean
train
function clean() { const distDir = "./dist"; try { fse.readdirSync(distDir).forEach(file => { let filePath = path.resolve(distDir, file); if (fse.lstatSync(filePath).isDirectory()) { logInfo("Clean distribution package " + file); try { ...
javascript
{ "resource": "" }
q46530
build
train
function build(pkgName, pkgVersion) { clean(); // Update framework name/version/build date in Runtime class updateRuntimeInfo(Date.now(), pkgName, pkgVersion); const buildDir = "./build"; fse.readdirSync(buildDir).forEach(file => { if (file.match(/tsconfig\..+\.json/gi)) { con...
javascript
{ "resource": "" }
q46531
info
train
function info(agentInfoFolder, defaultBuildMode) { return new Promise((resolve, reject) => { const result = generateAgentInfoFile(agentInfoFolder || "./src/", undefined, undefined, defaultBuildMode); resolve(result[1]); }); }
javascript
{ "resource": "" }
q46532
gulpBuildAgentInfo
train
function gulpBuildAgentInfo(agentInfoFolder, agentInfoFilename, packageFile) { if (agentInfoFilename === undefined) { agentInfoFilename = "agent.info.ts"; } if (packageFile === undefined) { packageFile = "package.json"; } return () => { const gulp = require("gulp"); c...
javascript
{ "resource": "" }
q46533
generateAgentInfoFile
train
function generateAgentInfoFile(agentInfoFolder, agentInfoFilename, packageFile, defaultBuildMode) { if (agentInfoFilename === undefined) { agentInfoFilename = "agent.info.ts"; } if (packageFile === undefined) { packageFile = "package.json"; } const fs = require("fs"); const path ...
javascript
{ "resource": "" }
q46534
generateAgentInfo
train
function generateAgentInfo(packageFile, defaultBuildMode) { if (defaultBuildMode === undefined) { defaultBuildMode = "development"; } const path = require("path"); const pkg = require(path.resolve(packageFile)); const buildMode = process.env.COATY_ENV || defaultBuildMode; const buildDate...
javascript
{ "resource": "" }
q46535
toLocalIsoString
train
function toLocalIsoString(date, includeMillis) { if (includeMillis === undefined) { includeMillis = false; } const pad = (n, length, padChar) => { if (length === undefined) { length = 2; } if (padChar === undefined) { padChar = "0"; } let str = "" + n; while (str.leng...
javascript
{ "resource": "" }
q46536
copy
train
function copy(text) { var fakeElem = document.body.appendChild(document.createElement('textarea')); fakeElem.style.position = 'absolute'; fakeElem.style.left = '-9999px'; fakeElem.setAttribute('readonly', ''); fakeElem.value = text; fakeElem.select(); try { return document.execCommand('copy'); } cat...
javascript
{ "resource": "" }
q46537
cleanPipeName
train
function cleanPipeName(str) { if (process.platform === 'win32' && !str.startsWith('\\\\.\\pipe\\')) { str = str.replace(/^\//, ''); str = str.replace(/\//g, '-'); return '\\\\.\\pipe\\' + str; } else { return str; } }
javascript
{ "resource": "" }
q46538
emitOverFastPath
train
function emitOverFastPath(state, msgObj, messageJson) { if (!state.options.node.useFastPath) return; // disabled var others = OTHER_INSTANCES[state.channelName].filter(function (s) { return s !== state; }); var checkObj = { time: msgObj.time, senderUuid: msgObj.uuid, token: msgObj.token }; ...
javascript
{ "resource": "" }
q46539
whenDeathListener
train
function whenDeathListener(msg) { if (msg.context === 'leader' && msg.action === 'death') { leaderElector.applyOnce().then(function () { if (leaderElector.isLeader) finish(); }); } }
javascript
{ "resource": "" }
q46540
writeMessage
train
function writeMessage(db, readerUuid, messageJson) { var time = new Date().getTime(); var writeObject = { uuid: readerUuid, time: time, data: messageJson }; var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite'); return new Promise(function (res, rej) { transaction.oncomplete = funct...
javascript
{ "resource": "" }
q46541
readNewMessages
train
function readNewMessages(state) { // channel already closed if (state.closed) return Promise.resolve(); // if no one is listening, we do not need to scan for new messages if (!state.messagesCallback) return Promise.resolve(); return getMessagesHigherThen(state.db, state.lastCursorId).then(function (newerMessag...
javascript
{ "resource": "" }
q46542
listenerFn
train
function listenerFn(msgObj) { channel._addEL[msgObj.type].forEach(function (obj) { if (msgObj.time >= obj.time) { obj.fn(msgObj.data); } }); }
javascript
{ "resource": "" }
q46543
_sendMessage
train
function _sendMessage(leaderElector, action) { const msgJson = { context: 'leader', action, token: leaderElector.token }; return leaderElector._channel.postInternal(msgJson); }
javascript
{ "resource": "" }
q46544
createSocketInfoFile
train
function createSocketInfoFile(channelName, readerUuid, paths) { const pathToFile = socketInfoPath(channelName, readerUuid, paths); return writeFile( pathToFile, JSON.stringify({ time: microSeconds() }) ).then(() => pathToFile); }
javascript
{ "resource": "" }
q46545
countChannelFolders
train
async function countChannelFolders() { await ensureBaseFolderExists(); const folders = await readdir(TMP_FOLDER_BASE); return folders.length; }
javascript
{ "resource": "" }
q46546
getReadersUuids
train
async function getReadersUuids(channelName, paths) { paths = paths || getPaths(channelName); const readersPath = paths.readers; const files = await readdir(readersPath); return files .map(file => file.split('.')) .filter(split => split[1] === 'json') // do not scan .socket-files ...
javascript
{ "resource": "" }
q46547
create
train
async function create(channelName, options = {}) { options = fillOptionsWithDefaults(options); const time = microSeconds(); const paths = getPaths(channelName); const ensureFolderExistsPromise = ensureFoldersExist(channelName, paths); const uuid = randomToken(10); const state = { time, ...
javascript
{ "resource": "" }
q46548
handleMessagePing
train
async function handleMessagePing(state, msgObj) { /** * when there are no listener, we do nothing */ if (!state.messagesCallback) return; let messages; if (!msgObj) { // get all messages = await getAllMessages(state.channelName, state.paths); } else { // get singl...
javascript
{ "resource": "" }
q46549
train
function () { /** * The callback function grabbed from the array-like arguments * object. The first argument should always be the callback. * * @see [arguments]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arg...
javascript
{ "resource": "" }
q46550
train
function (callback) { return function (e) { var newValue = session.getValue(); if (ngModel && newValue !== ngModel.$viewValue && // HACK make sure to only trigger the apply outside of the // digest loop 'cause ACE is actually using this callba...
javascript
{ "resource": "" }
q46551
train
function (current, previous) { if (current === previous) return; opts = angular.extend({}, options, scope.$eval(attrs.uiAce)); opts.callbacks = [ opts.onLoad ]; if (opts.onLoad !== options.onLoad) { // also call the global onLoad handler opts.callbacks.un...
javascript
{ "resource": "" }
q46552
addGraphics
train
function addGraphics(buffer) { layer.add(new Graphic({ geometry: meteorPoint, symbol: pointSym })); layer.add(new Graphic({ geometry: buffer, symbol: polySym })); ...
javascript
{ "resource": "" }
q46553
zoomTo
train
function zoomTo(geom) { // when the view is ready return self.view.when(function() { // zoom to the buffer geometry return self.view.goTo({ target: geom, scale: 24000, tilt: 0,...
javascript
{ "resource": "" }
q46554
train
function(path) { var pathParts = this.getPathParts(path), tabs, page; if (pathParts.length === 0) { return; } page = pathParts[0]; if (!page) { return; ...
javascript
{ "resource": "" }
q46555
train
function(data, configUpdater) { var updater = configUpdater || function(config) {return config;}; $rootScope.$broadcast('event:auth-loginConfirmed', data); httpBuffer.retryAll(updater); }
javascript
{ "resource": "" }
q46556
train
function(updater) { for (var i = 0; i < buffer.length; ++i) { var _cfg = updater(buffer[i].config); if (_cfg !== false) retryHttpRequest(_cfg, buffer[i].deferred); } buffer = []; }
javascript
{ "resource": "" }
q46557
train
function(color) { var self = this; var $colorSpan = self.$colorList.find('> span.color').filter(function() { return $(this).data('color').toLowerCase() === color.toLowerCase(); }); if ($colorSpan.length > 0) { self.selectColorSpan($colorSpan); } else { console.err...
javascript
{ "resource": "" }
q46558
findMatchingSimulator
train
function findMatchingSimulator(simulators, simulatorName) { if (!simulators.devices) { return null; } const devices = simulators.devices; var match; for (let version in devices) { // Making sure the version of the simulator is an iOS (Removes Apple Watch, etc) if (version.indexOf('iOS') !== 0) { ...
javascript
{ "resource": "" }
q46559
sign
train
function sign(file_data) { var first_time = file_data.indexOf(TOKEN) !== -1; if (!first_time) { if (is_signed(file_data)) file_data = file_data.replace(PATTERN, signing_token()); else throw exports.TokenNotFoundError; } var signature = md5_hash_hex(file_data, 'utf8'); var signed_data = fil...
javascript
{ "resource": "" }
q46560
verify_signature
train
function verify_signature(file_data) { var match = PATTERN.exec(file_data); if (!match) return exports.SIGN_UNSIGNED; // Replace the signature with the TOKEN, then hash and see if it matches // the value in the file. For backwards compatibility, also try with // OLDTOKEN if that doesn't match. var k, t...
javascript
{ "resource": "" }
q46561
copyToClipBoard
train
function copyToClipBoard(content) { switch (process.platform) { case 'darwin': var child = spawn('pbcopy', []); child.stdin.end(new Buffer(content, 'utf8')); return true; default: return false; } }
javascript
{ "resource": "" }
q46562
generate
train
function generate(argv, config) { return new Promise((resolve, reject) => { _generate(argv, config, resolve, reject); }); }
javascript
{ "resource": "" }
q46563
server
train
function server(argv, config, args) { const roots = args.projectRoots.concat(args.root); args.projectRoots = roots.concat( findSymlinksPaths(NODE_MODULES, roots) ); console.log(formatBanner( 'Running packager on port ' + args.port + '.\n\n' + 'Keep this packager running while developing on any JS p...
javascript
{ "resource": "" }
q46564
findParentDirectory
train
function findParentDirectory(currentFullPath, filename) { const root = path.parse(currentFullPath).root; const testDir = (parts) => { if (parts.length === 0) { return null; } const fullPath = path.join(root, parts.join(path.sep)); var exists = fs.existsSync(path.join(fullPath, filename)); ...
javascript
{ "resource": "" }
q46565
changedKeys
train
function changedKeys(props, newProps) { return Object.keys(props).filter(key => { return props[key] !== newProps[key]; }); }
javascript
{ "resource": "" }
q46566
computedReduxProperty
train
function computedReduxProperty(key, getProps) { return computed({ get: () => getProps()[key], set: () => { assert(`Cannot set redux property "${key}". Try dispatching a redux action instead.`); } }); }
javascript
{ "resource": "" }
q46567
getAttrs
train
function getAttrs(context) { const keys = Object.keys(context.attrs || {}); return getProperties(context, keys); }
javascript
{ "resource": "" }
q46568
train
function (index) { var $rating = this.$rating; // Get the index of the last whole symbol. var i = Math.floor(index); // Hide completely hidden symbols background. $rating.find('.rating-symbol-background') .css('visibility', 'visible') .slice(0, i).css('visibility', 'hidden'...
javascript
{ "resource": "" }
q46569
train
function (index) { return this.options.start + Math.floor(index) * this.options.step + this.options.step * this._roundToFraction(index % 1); }
javascript
{ "resource": "" }
q46570
train
function (index) { // Get the closest top fraction. var fraction = Math.ceil(index % 1 * this.options.fractions) / this.options.fractions; // Truncate decimal trying to avoid float precission issues. var p = Math.pow(10, this.options.scale); return Math.floor(index) + Math.floor(fraction *...
javascript
{ "resource": "" }
q46571
train
function (rate) { var value = parseFloat(rate); if (this._contains(value)) { this._fillUntil(this._rateToIndex(value)); this.$input.val(value); } else if (rate === '') { this._fillUntil(0); this.$input.val(''); } }
javascript
{ "resource": "" }
q46572
isModifiedSince
train
function isModifiedSince(req, res) { try { if (req.headers['if-unmodified-since']) { const jobTime = Date.parse(req.headers['if-unmodified-since']); const revInfo = mwUtil.parseETag(res.headers.etag); return revInfo && uuid.fromString(revInfo.tid).getDate() >= jobTime; ...
javascript
{ "resource": "" }
q46573
_dependenciesUpdate
train
function _dependenciesUpdate(hyper, req, newContent = true) { const rp = req.params; return mwUtil.getSiteInfo(hyper, req) .then((siteInfo) => { const baseUri = siteInfo.baseUri.replace(/^https?:/, ''); const publicURI = `${baseUri}/page/html/${encodeURIComponent(rp.title)}`; const b...
javascript
{ "resource": "" }
q46574
checkContentType
train
function checkContentType(hyper, req, next, expectedContentType, responsePromise) { return responsePromise .then((res) => { // Do not check or re-render if the response was only rendered within // the last two minutes. if (res.headers && res.headers.etag && Date.now() - mwUti...
javascript
{ "resource": "" }
q46575
getUserFromSocket
train
function getUserFromSocket(socket, callback) { let wait = false; try { if (socket.handshake.headers.cookie && (!socket.request || !socket.request._query || !socket.request._query.user)) { let cookie = decodeURIComponent(socket.handshake.headers.cookie); l...
javascript
{ "resource": "" }
q46576
updateSession
train
function updateSession(socket) { if (socket._sessionID) { let time = (new Date()).getTime(); if (socket._lastActivity && time - socket._lastActivity > settings.ttl * 1000) { socket.emit('reauthenticate'); socket.disconnect(); return f...
javascript
{ "resource": "" }
q46577
verifyModules
train
function verifyModules(filePaths) { return Promise.all( _.map(filePaths, function(filePath) { return firstline(filePath).then(function(line) { var matches = line.match(/^(?:(?:port|effect)\s+)?module\s+(\S+)\s*/); if (matches) { var moduleName = matches[1]; var testModul...
javascript
{ "resource": "" }
q46578
_VirtualDom_pairwiseRefEqual
train
function _VirtualDom_pairwiseRefEqual(as, bs) { for (var i = 0; i < as.length; i++) { if (as[i] !== bs[i]) { return false; } } return true; }
javascript
{ "resource": "" }
q46579
mousedown
train
function mousedown(e, space) { var offset = plate.offset(), isTouch = /^touch/.test(e.type), x0 = offset.left + dialRadius, y0 = offset.top + dialRadius, dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0, dy = (isTouch ...
javascript
{ "resource": "" }
q46580
setScopeValues
train
function setScopeValues(scope, attrs) { scope.List = []; scope.Hide = false; scope.page = parseInt(scope.page) || 1; scope.total = parseInt(scope.total) || 0; scope.dots = scope.dots || '...'; scope.ulClass = scope.ulClass |...
javascript
{ "resource": "" }
q46581
validateScopeValues
train
function validateScopeValues(scope, pageCount) { // Block where the page is larger than the pageCount if (scope.page > pageCount) { scope.page = pageCount; } // Block where the page is less than 0 if (scope.page <= 0) {...
javascript
{ "resource": "" }
q46582
internalAction
train
function internalAction(scope, page) { page = page.valueOf(); // Block clicks we try to load the active page if (scope.page == page) { return; } // Update the page in scope and fire any paging actions sc...
javascript
{ "resource": "" }
q46583
addRange
train
function addRange(start, finish, scope) { var i = 0; for (i = start; i <= finish; i++) { var item = { value: $sce.trustAsHtml(i.toString()), liClass: scope.page == i ? scope.activeClass : 'waves-effect', ...
javascript
{ "resource": "" }
q46584
build
train
function build(scope, attrs) { // Block divide by 0 and empty page size if (!scope.pageSize || scope.pageSize < 0) { return; } // Assign scope values setScopeValues(scope, attrs); // lo...
javascript
{ "resource": "" }
q46585
init
train
function init() { element.addClass("tooltipped"); $compile(element.contents())(scope); $timeout(function () { // https://github.com/Dogfalo/materialize/issues/3546 // if element.addClass("too...
javascript
{ "resource": "" }
q46586
getFilePathFromUrl
train
function getFilePathFromUrl(url, basePath, { pathLib = path } = {}) { if (!basePath) { throw new Error('basePath must be specified'); } if (!pathLib.isAbsolute(basePath)) { throw new Error(`${basePath} is invalid - must be absolute`); } const relativePath = url.split('?')[0]; if (relativePath.inde...
javascript
{ "resource": "" }
q46587
Lock
train
function Lock(target, name, descriptor) { let fn = descriptor.value; let $$LockIsDoing = false; let reset = ()=>$$LockIsDoing=false; descriptor.value = function(...args) { if ($$LockIsDoing) return; $$LockIsDoing = true; let ret = fn.apply(this, args); if (ret && ret.t...
javascript
{ "resource": "" }
q46588
Deprecate
train
function Deprecate(methodDescriptor) { let {descriptor, key} = methodDescriptor; let fn = descriptor.value; descriptor.value = function(...args) { console.warn(`DEPRECATE: [${key}] This function will be removed in future versions.`); return fn.apply(this, args); }; return { ...
javascript
{ "resource": "" }
q46589
train
function(template) { // Automatically add the `.html` extension. template = template + ".html"; // Put this fetch into `async` mode to work better in the Node environment. var done = this.async(); // By default read in the file from the filesystem relative to the code // being executed. fs...
javascript
{ "resource": "" }
q46590
train
function(rendered, manager, def) { // Actually put the rendered contents into the element. if (_.isString(rendered)) { // If no container is specified, we must replace the content. if (manager.noel) { rendered = $.parseHTML(rendered, true); // Remove extra root elements. thi...
javascript
{ "resource": "" }
q46591
done
train
function done(context, template) { // Store the rendered template someplace so it can be re-assignable. var rendered; // Trigger this once the render method has completed. manager.callback = function(rendered) { // Clean up asynchronous manager properties. delete manager.isAsync...
javascript
{ "resource": "" }
q46592
Layout
train
function Layout(options) { // Grant this View superpowers. this.manage = true; // Give this View access to all passed options as instance properties. _.extend(this, options); // Have Backbone set up the rest of this View. Backbone.View.apply(this, arguments); }
javascript
{ "resource": "" }
q46593
train
function(selector, view) { // If the `view` argument exists, then a selector was passed in. This code // path will forward the selector on to `setView`. if (view) { return this.setView(selector, view, true); } // If no `view` argument is defined, then assume the first argument is the // ...
javascript
{ "resource": "" }
q46594
train
function(views) { // If an array of views was passed it should be inserted into the // root view. Much like calling insertView without a selector. if (_.isArray(views)) { return this.setViews({ "": views }); } _.each(views, function(view, selector) { views[selector] = _.isArray(view) ? ...
javascript
{ "resource": "" }
q46595
train
function(fn) { var views; // If the filter argument is a String, then return a chained Version of the // elements. The value at the specified filter may be undefined, a single // view, or an array of views; in all cases, chain on a flat array. if (typeof fn === "string") { fn = this.sections[...
javascript
{ "resource": "" }
q46596
train
function(fn) { var views; // Allow an optional selector or function to find the right model and // remove nested Views based off the results of the selector or filter. views = this.getViews(fn).each(function(nestedView) { nestedView.remove(); }); // call value incase the chain is evaluat...
javascript
{ "resource": "" }
q46597
train
function(views) { // Iterate over all the views and use the View's view method to assign. _.each(views, function(view, name) { // If the view is an array put all views into insert mode. if (_.isArray(view)) { return _.each(view, function(view) { this.insertView(name, view); ...
javascript
{ "resource": "" }
q46598
resolve
train
function resolve() { // Insert all subViews into the parent at once. _.each(root.views, function(views, selector) { // Fragments aren't used on arrays of subviews. if (_.isArray(views)) { root.htmlBatch(root, views, selector); } }); // If there is a parent and...
javascript
{ "resource": "" }
q46599
completeRender
train
function completeRender() { var console = window.console; var afterRender = root.afterRender; if (afterRender) { afterRender.call(root, root); } // Always emit an afterRender event. root.trigger("afterRender", root); // If there are multiple top level...
javascript
{ "resource": "" }