_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q16800 | getFile | train | function getFile(name, next) {
// save the callback
fileCallBacks[name] = next;
setImmediate(function () {
try {
ExtractContent.extractContent(name, handleGetFile, _requestFileContent);
} catch (error) {
console.log(error);
}
});
} | javascript | {
"resource": ""
} |
q16801 | resetTernServer | train | function resetTernServer() {
// If a server is already created just reset the analysis data
if (ternServer) {
ternServer.reset();
Infer.resetGuessing();
// tell the main thread we're ready to start processing again
self.postMessage({type: MessageIds.TERN_WORKER_READY});
}
} | javascript | {
"resource": ""
} |
q16802 | buildRequest | train | function buildRequest(fileInfo, query, offset) {
query = {type: query};
query.start = offset;
query.end = offset;
query.file = (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) ? "#0" : fileInfo.name;
query.filter = false;
query.sort = false;
query.depths = true;
query.guess = true... | javascript | {
"resource": ""
} |
q16803 | getRefs | train | function getRefs(fileInfo, offset) {
var request = buildRequest(fileInfo, "refs", offset);
try {
ternServer.request(request, function (error, data) {
if (error) {
_log("Error returned from Tern 'refs' request: " + error);
var response = {
t... | javascript | {
"resource": ""
} |
q16804 | getScopeData | train | function getScopeData(fileInfo, offset) {
// Create a new tern Server
// Existing tern server resolves all the required modules which might take time
// We only need to analyze single file for getting the scope
ternOptions.plugins = {};
var ternServer = new Tern.Server(ternOptions);
ternServer.a... | javascript | {
"resource": ""
} |
q16805 | getTernProperties | train | function getTernProperties(fileInfo, offset, type) {
var request = buildRequest(fileInfo, "properties", offset),
i;
//_log("tern properties: request " + request.type + dir + " " + file);
try {
ternServer.request(request, function (error, data) {
var properties = [];
... | javascript | {
"resource": ""
} |
q16806 | getTernHints | train | function getTernHints(fileInfo, offset, isProperty) {
var request = buildRequest(fileInfo, "completions", offset),
i;
//_log("request " + dir + " " + file + " " + offset /*+ " " + text */);
try {
ternServer.request(request, function (error, data) {
var completions = [];
... | javascript | {
"resource": ""
} |
q16807 | inferArrTypeToString | train | function inferArrTypeToString(inferArrType) {
var result = "Array.<";
result += inferArrType.props["<i>"].types.map(inferTypeToString).join(", ");
// workaround case where types is zero length
if (inferArrType.props["<i>"].types.length === 0) {
result += "Object";
}... | javascript | {
"resource": ""
} |
q16808 | handleFunctionType | train | function handleFunctionType(fileInfo, offset) {
var request = buildRequest(fileInfo, "type", offset),
error;
request.query.preferFunction = true;
var fnType = "";
try {
ternServer.request(request, function (ternError, data) {
if (ternError) {
_log("Error fo... | javascript | {
"resource": ""
} |
q16809 | handleUpdateFile | train | function handleUpdateFile(path, text) {
ternServer.addFile(path, text);
self.postMessage({type: MessageIds.TERN_UPDATE_FILE_MSG,
path: path
});
// reset to get the best hints with the updated file.
ternServer.reset();
Infer.resetGuessing();
} | javascript | {
"resource": ""
} |
q16810 | handlePrimePump | train | function handlePrimePump(path) {
var fileName = _getDenormalizedFilename(path);
var fileInfo = createEmptyUpdate(fileName),
request = buildRequest(fileInfo, "completions", {line: 0, ch: 0});
try {
ternServer.request(request, function (error, data) {
// Post a message back to the... | javascript | {
"resource": ""
} |
q16811 | _updateScrollerShadow | train | function _updateScrollerShadow($displayElement, $scrollElement, $shadowTop, $shadowBottom, isPositionFixed) {
var offsetTop = 0,
scrollElement = $scrollElement.get(0),
scrollTop = scrollElement.scrollTop,
topShadowOffset = Math.min(scrollTop - SC... | javascript | {
"resource": ""
} |
q16812 | addScrollerShadow | train | function addScrollerShadow(displayElement, scrollElement, showBottom) {
// use fixed positioning when the display and scroll elements are the same
var isPositionFixed = false;
if (!scrollElement) {
scrollElement = displayElement;
isPositionFixed = true;
}
... | javascript | {
"resource": ""
} |
q16813 | removeScrollerShadow | train | function removeScrollerShadow(displayElement, scrollElement) {
if (!scrollElement) {
scrollElement = displayElement;
}
var $displayElement = $(displayElement),
$scrollElement = $(scrollElement);
// remove scrollerShadow elements from DOM
$displayElement.... | javascript | {
"resource": ""
} |
q16814 | getElementClipSize | train | function getElementClipSize($view, elementRect) {
var delta,
clip = { top: 0, right: 0, bottom: 0, left: 0 },
viewOffset = $view.offset() || { top: 0, left: 0};
// Check if element extends below viewport
delta = (elementRect.top + elementRect.height) - (viewOffset.top + ... | javascript | {
"resource": ""
} |
q16815 | scrollElementIntoView | train | function scrollElementIntoView($view, $element, scrollHorizontal) {
var elementOffset = $element.offset();
// scroll minimum amount
var elementRect = {
top: elementOffset.top,
left: elementOffset.left,
height: $element.height(),
... | javascript | {
"resource": ""
} |
q16816 | getFileEntryDisplay | train | function getFileEntryDisplay(entry) {
var name = entry.name,
ext = LanguageManager.getCompoundFileExtension(name),
i = name.lastIndexOf("." + ext);
if (i > 0) {
// Escape all HTML-sensitive characters in filename.
name = _.escape(name.substring(0, i)) + "... | javascript | {
"resource": ""
} |
q16817 | getDirNamesForDuplicateFiles | train | function getDirNamesForDuplicateFiles(files) {
// Must have at least two files in list for this to make sense
if (files.length <= 1) {
return [];
}
// First collect paths from the list of files and fill map with them
var map = {}, filePaths = [], displayPaths = [];
... | javascript | {
"resource": ""
} |
q16818 | train | function (map) {
var didSomething = false;
_.forEach(map, function (arr, key) {
// length > 1 means we have duplicates that need to be resolved
if (arr.length > 1) {
arr.forEach(function (index) {
if (filePaths[index].le... | javascript | {
"resource": ""
} | |
q16819 | filterForKeyword | train | function filterForKeyword(extensionList, word) {
var filteredList = [];
extensionList.forEach(function (id) {
var entry = self._getEntry(id);
if (entry && self._entryMatchesQuery(entry, word)) {
filteredList.push(id);
}
... | javascript | {
"resource": ""
} |
q16820 | loadExtensionModule | train | function loadExtensionModule(name, config, entryPoint) {
var extensionConfig = {
context: name,
baseUrl: config.baseUrl,
paths: globalPaths,
locale: brackets.getLocale()
};
// Read optional requirejs-config.json
var promise = _mergeConfig(... | javascript | {
"resource": ""
} |
q16821 | loadExtension | train | function loadExtension(name, config, entryPoint) {
var promise = new $.Deferred();
// Try to load the package.json to figure out if we are loading a theme.
ExtensionUtils.loadMetadata(config.baseUrl).always(promise.resolve);
return promise
.then(function (metadata) {
... | javascript | {
"resource": ""
} |
q16822 | init | train | function init(paths) {
var params = new UrlParams();
if (_init) {
// Only init once. Return a resolved promise.
return new $.Deferred().resolve().promise();
}
if (!paths) {
params.parse();
if (params.get("reloadWithoutUserExts") === "tru... | javascript | {
"resource": ""
} |
q16823 | _applyAllCallbacks | train | function _applyAllCallbacks(callbacks, args) {
if (callbacks.length > 0) {
var callback = callbacks.pop();
try {
callback.apply(undefined, args);
} finally {
_applyAllCallbacks(callbacks, args);
}
}
} | javascript | {
"resource": ""
} |
q16824 | doCreate | train | function doCreate(path, isFolder) {
var d = new $.Deferred();
var filename = FileUtils.getBaseName(path);
// Check if filename
if (!isValidFilename(filename)){
return d.reject(ERROR_INVALID_FILENAME).promise();
}
// Check if fullpath with filename is valid
... | javascript | {
"resource": ""
} |
q16825 | _isWelcomeProjectPath | train | function _isWelcomeProjectPath(path, welcomeProjectPath, welcomeProjects) {
if (path === welcomeProjectPath) {
return true;
}
// No match on the current path, and it's not a match if there are no previously known projects
if (!welcomeProjects) {
return false;
... | javascript | {
"resource": ""
} |
q16826 | _getVersionInfoUrl | train | function _getVersionInfoUrl(localeParam) {
var locale = localeParam || brackets.getLocale();
if (locale.length > 2) {
locale = locale.substring(0, 2);
}
return brackets.config.notification_info_url.replace("<locale>", locale);
} | javascript | {
"resource": ""
} |
q16827 | _getNotificationInformation | train | function _getNotificationInformation(_notificationInfoUrl) {
// Last time the versionInfoURL was fetched
var lastInfoURLFetchTime = PreferencesManager.getViewState("lastNotificationURLFetchTime");
var result = new $.Deferred();
var fetchData = false;
var data;
// If we ... | javascript | {
"resource": ""
} |
q16828 | checkForNotification | train | function checkForNotification(versionInfoUrl) {
var result = new $.Deferred();
_getNotificationInformation(versionInfoUrl)
.done(function (notificationInfo) {
// Get all available notifications
var notifications = notificationInfo.notifications;
... | javascript | {
"resource": ""
} |
q16829 | splitNs | train | function splitNs(eventStr) {
var dot = eventStr.indexOf(".");
if (dot === -1) {
return { eventName: eventStr };
} else {
return { eventName: eventStr.substring(0, dot), ns: eventStr.substring(dot) };
}
} | javascript | {
"resource": ""
} |
q16830 | _hidePanelsIfRequired | train | function _hidePanelsIfRequired() {
var panelIDs = WorkspaceManager.getAllPanelIDs();
_previouslyOpenPanelIDs = [];
panelIDs.forEach(function (panelID) {
var panel = WorkspaceManager.getPanelForID(panelID);
if (panel && panel.isVisible()) {
panel.hide();
... | javascript | {
"resource": ""
} |
q16831 | initializeCommands | train | function initializeCommands() {
CommandManager.register(Strings.CMD_TOGGLE_PURE_CODE, CMD_TOGGLE_PURE_CODE, _togglePureCode);
CommandManager.register(Strings.CMD_TOGGLE_PANELS, CMD_TOGGLE_PANELS, _togglePanels);
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).addMenuItem(CMD_TOGGLE_PANELS, "", Menus.... | javascript | {
"resource": ""
} |
q16832 | _findChangedCharacters | train | function _findChangedCharacters(oldValue, value) {
if (oldValue === value) {
return undefined;
}
var length = oldValue.length;
var index = 0;
// find the first character that changed
var i;
for (i = 0; i < length; i++) {
if (value[i] !== o... | javascript | {
"resource": ""
} |
q16833 | updateResizeLimits | train | function updateResizeLimits() {
var editorAreaHeight = $editorHolder.height();
$editorHolder.siblings().each(function (i, elem) {
var $elem = $(elem);
if ($elem.css("display") === "none") {
$elem.data("maxsize", editorAreaHeight);
} else {
... | javascript | {
"resource": ""
} |
q16834 | handleWindowResize | train | function handleWindowResize() {
// These are not initialized in Jasmine Spec Runner window until a test
// is run that creates a mock document.
if (!$windowContent || !$editorHolder) {
return;
}
// FIXME (issue #4564) Workaround https://github.com/codemirror/CodeMirr... | javascript | {
"resource": ""
} |
q16835 | createBottomPanel | train | function createBottomPanel(id, $panel, minSize) {
$panel.insertBefore("#status-bar");
$panel.hide();
updateResizeLimits(); // initialize panel's max size
panelIDMap[id] = new Panel($panel, minSize);
panelIDMap[id].panelID = id;
return panelIDMap[id];
} | javascript | {
"resource": ""
} |
q16836 | getAllPanelIDs | train | function getAllPanelIDs() {
var property, panelIDs = [];
for (property in panelIDMap) {
if (panelIDMap.hasOwnProperty(property)) {
panelIDs.push(property);
}
}
return panelIDs;
} | javascript | {
"resource": ""
} |
q16837 | getAggregatedHealthData | train | function getAggregatedHealthData() {
var healthData = getStoredHealthData();
$.extend(healthData, PerfUtils.getHealthReport());
$.extend(healthData, FindUtils.getHealthReport());
return healthData;
} | javascript | {
"resource": ""
} |
q16838 | setHealthDataLog | train | function setHealthDataLog(key, dataObject) {
var healthData = getStoredHealthData();
healthData[key] = dataObject;
setHealthData(healthData);
} | javascript | {
"resource": ""
} |
q16839 | fileOpened | train | function fileOpened(filePath, addedToWorkingSet, encoding) {
if (!shouldLogHealthData()) {
return;
}
var fileExtension = FileUtils.getFileExtension(filePath),
language = LanguageManager.getLanguageForPath(filePath),
healthData = getStoredHealthData(),
... | javascript | {
"resource": ""
} |
q16840 | fileSaved | train | function fileSaved(docToSave) {
if (!docToSave) {
return;
}
var fileType = docToSave.language ? docToSave.language._name : "";
sendAnalyticsData(commonStrings.USAGE + commonStrings.FILE_SAVE + fileType,
commonStrings.USAGE,
... | javascript | {
"resource": ""
} |
q16841 | fileClosed | train | function fileClosed(file) {
if (!file) {
return;
}
var language = LanguageManager.getLanguageForPath(file._path),
size = -1;
function _sendData(fileSize) {
var subType = "";
if(fileSize/1024 <= 1) {
if(fileSize < 0) {
... | javascript | {
"resource": ""
} |
q16842 | searchDone | train | function searchDone(searchType) {
var searchDetails = getHealthDataLog("searchDetails");
if (!searchDetails) {
searchDetails = {};
}
if (!searchDetails[searchType]) {
searchDetails[searchType] = 0;
}
searchDetails[searchType]++;
setHealthDa... | javascript | {
"resource": ""
} |
q16843 | sendAnalyticsData | train | function sendAnalyticsData(eventName, eventCategory, eventSubCategory, eventType, eventSubType) {
var isEventDataAlreadySent = analyticsEventMap.get(eventName),
isHDTracking = PreferencesManager.getExtensionPrefs("healthData").get("healthDataTracking"),
eventParams = {};
if (i... | javascript | {
"resource": ""
} |
q16844 | isStaticHtmlFileExt | train | function isStaticHtmlFileExt(filePath) {
if (!filePath) {
return false;
}
return (_staticHtmlFileExts.indexOf(LanguageManager.getLanguageForPath(filePath).getId()) !== -1);
} | javascript | {
"resource": ""
} |
q16845 | isServerHtmlFileExt | train | function isServerHtmlFileExt(filePath) {
if (!filePath) {
return false;
}
return (_serverHtmlFileExts.indexOf(LanguageManager.getLanguageForPath(filePath).getId()) !== -1);
} | javascript | {
"resource": ""
} |
q16846 | updateDirtyFilesCache | train | function updateDirtyFilesCache(name, action) {
if (action) {
_dirtyFilesCache[name] = true;
} else {
if (_dirtyFilesCache[name]) {
delete _dirtyFilesCache[name];
}
}
} | javascript | {
"resource": ""
} |
q16847 | InstallExtensionDialog | train | function InstallExtensionDialog(installer, _isUpdate) {
this._installer = installer;
this._state = STATE_CLOSED;
this._installResult = null;
this._isUpdate = _isUpdate;
// Timeout before we allow user to leave STATE_INSTALL_CANCELING without waiting for a resolution
// (... | javascript | {
"resource": ""
} |
q16848 | get | train | function get(command) {
var commandID;
if (!command) {
console.error("Attempting to get a Sort method with a missing required parameter: command");
return;
}
if (typeof command === "string") {
commandID = command;
} else {
commandI... | javascript | {
"resource": ""
} |
q16849 | _convertSortPref | train | function _convertSortPref(sortMethod) {
if (!sortMethod) {
return null;
}
if (_sortPrefConversionMap.hasOwnProperty(sortMethod)) {
sortMethod = _sortPrefConversionMap[sortMethod];
PreferencesManager.setViewState(_WORKING_SET_SORT_PREF, sortMethod);
} ... | javascript | {
"resource": ""
} |
q16850 | _addListeners | train | function _addListeners() {
if (_automaticSort && _currentSort && _currentSort.getEvents()) {
MainViewManager
.on(_currentSort.getEvents(), function () {
_currentSort.sort();
})
.on("_workingSetDisableAutoSort.sort", function () {
... | javascript | {
"resource": ""
} |
q16851 | _setCurrentSort | train | function _setCurrentSort(newSort) {
if (_currentSort !== newSort) {
if (_currentSort !== null) {
_currentSort.setChecked(false);
}
if (_automaticSort) {
newSort.setChecked(true);
}
CommandManager.get(Commands.CMD_WORKIN... | javascript | {
"resource": ""
} |
q16852 | register | train | function register(command, compareFn, events) {
var commandID = "";
if (!command || !compareFn) {
console.log("Attempting to register a Sort method with a missing required parameter: command or compare function");
return;
}
if (typeof command === "string") {
... | javascript | {
"resource": ""
} |
q16853 | train | function () {
var attributeString = JSON.stringify(this.attributes);
this.attributeSignature = MurmurHash3.hashString(attributeString, attributeString.length, seed);
} | javascript | {
"resource": ""
} | |
q16854 | allNodesAtLocation | train | function allNodesAtLocation(location) {
var nodes = [];
exports.root.each(function each(n) {
if (n.type === DOMNode.TYPE_ELEMENT && n.isAtLocation(location)) {
nodes.push(n);
}
});
return nodes;
} | javascript | {
"resource": ""
} |
q16855 | nodeAtLocation | train | function nodeAtLocation(location) {
return exports.root.find(function each(n) {
return n.isAtLocation(location, false);
});
} | javascript | {
"resource": ""
} |
q16856 | _cleanURL | train | function _cleanURL(url) {
var index = url.search(/[#\?]/);
if (index >= 0) {
url = url.substr(0, index);
}
return url;
} | javascript | {
"resource": ""
} |
q16857 | _mapDocumentToSource | train | function _mapDocumentToSource(source) {
var node = exports.root;
DOMHelpers.eachNode(source, function each(payload) {
if (!node) {
return true;
}
if (payload.closing) {
var parent = node.findParentForNextNodeMatchingPayload(payload);
... | javascript | {
"resource": ""
} |
q16858 | _onFinishedLoadingDOM | train | function _onFinishedLoadingDOM() {
var request = new XMLHttpRequest();
request.open("GET", exports.url);
request.onload = function onLoad() {
if ((request.status >= 200 && request.status < 300) ||
request.status === 304 || request.status === 0) {
_... | javascript | {
"resource": ""
} |
q16859 | applyChange | train | function applyChange(from, to, text) {
var delta = from - to + text.length;
var node = nodeAtLocation(from);
// insert a text node
if (!node) {
if (!(/^\s*$/).test(text)) {
console.warn("Inserting nodes not supported.");
node = nodeBeforeLocat... | javascript | {
"resource": ""
} |
q16860 | _validateNonEmptyString | train | function _validateNonEmptyString(value, description, deferred) {
var reportError = deferred ? deferred.reject : console.error;
// http://stackoverflow.com/questions/1303646/check-whether-variable-is-number-or-string-in-javascript
if (Object.prototype.toString.call(value) !== "[object String]") ... | javascript | {
"resource": ""
} |
q16861 | _patchCodeMirror | train | function _patchCodeMirror() {
var _original_CodeMirror_defineMode = CodeMirror.defineMode;
function _wrapped_CodeMirror_defineMode(name) {
if (CodeMirror.modes[name]) {
console.error("There already is a CodeMirror mode with the name \"" + name + "\"");
return;... | javascript | {
"resource": ""
} |
q16862 | _setLanguageForMode | train | function _setLanguageForMode(mode, language) {
if (_modeToLanguageMap[mode]) {
console.warn("CodeMirror mode \"" + mode + "\" is already used by language " + _modeToLanguageMap[mode]._name + " - cannot fully register language " + language._name +
" using the same mode. Some ... | javascript | {
"resource": ""
} |
q16863 | _getLanguageForMode | train | function _getLanguageForMode(mode) {
var language = _modeToLanguageMap[mode];
if (language) {
return language;
}
// In case of unsupported languages
console.log("Called LanguageManager._getLanguageForMode with a mode for which no language has been registered:", mode)... | javascript | {
"resource": ""
} |
q16864 | defineLanguage | train | function defineLanguage(id, definition) {
var result = new $.Deferred();
if (_pendingLanguages[id]) {
result.reject("Language \"" + id + "\" is waiting to be resolved.");
return result.promise();
}
if (_languages[id]) {
result.reject("Language \"" + i... | javascript | {
"resource": ""
} |
q16865 | addPopUp | train | function addPopUp($popUp, removeHandler, autoRemove) {
autoRemove = autoRemove || false;
_popUps.push($popUp[0]);
$popUp.data("PopUpManager-autoRemove", autoRemove);
$popUp.data("PopUpManager-removeHandler", removeHandler);
} | javascript | {
"resource": ""
} |
q16866 | handleError | train | function handleError(message, url, line) {
// Ignore this error if it does not look like the rather vague cross origin error in Chrome
// Chrome will print it to the console anyway
if (!testCrossOriginError(message, url, line)) {
if (previousErrorHandler) {
return pre... | javascript | {
"resource": ""
} |
q16867 | _loadStyles | train | function _loadStyles() {
var lessText = require("text!LiveDevelopment/main.less");
less.render(lessText, function onParse(err, tree) {
console.assert(!err, err);
ExtensionUtils.addEmbeddedStyleSheet(tree.css);
});
} | javascript | {
"resource": ""
} |
q16868 | _setLabel | train | function _setLabel($btn, text, style, tooltip) {
// Clear text/styles from previous status
$("span", $btn).remove();
$btn.removeClass(_allStatusStyles);
// Set text/styles for new status
if (text && text.length > 0) {
$("<span class=\"label\">")
.addC... | javascript | {
"resource": ""
} |
q16869 | _handleGoLiveCommand | train | function _handleGoLiveCommand() {
if (LiveDevImpl.status >= LiveDevImpl.STATUS_ACTIVE) {
LiveDevImpl.close();
} else if (LiveDevImpl.status <= LiveDevImpl.STATUS_INACTIVE) {
if (!params.get("skipLiveDevelopmentInfo") && !PreferencesManager.getViewState("livedev.afterFirstLaunch")... | javascript | {
"resource": ""
} |
q16870 | _showStatusChangeReason | train | function _showStatusChangeReason(reason) {
// Destroy the previous twipsy (options are not updated otherwise)
_$btnGoLive.twipsy("hide").removeData("twipsy");
// If there was no reason or the action was an explicit request by the user, don't show a twipsy
if (!reason || reason === "expl... | javascript | {
"resource": ""
} |
q16871 | _setupGoLiveButton | train | function _setupGoLiveButton() {
if (!_$btnGoLive) {
_$btnGoLive = $("#toolbar-go-live");
_$btnGoLive.click(function onGoLive() {
_handleGoLiveCommand();
});
}
LiveDevImpl.on("statusChange", function statusChange(event, status, reason) {
... | javascript | {
"resource": ""
} |
q16872 | _setupGoLiveMenu | train | function _setupGoLiveMenu() {
LiveDevImpl.on("statusChange", function statusChange(event, status) {
// Update the checkmark next to 'Live Preview' menu item
// Add checkmark when status is STATUS_ACTIVE; otherwise remove it
CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).... | javascript | {
"resource": ""
} |
q16873 | _setImplementation | train | function _setImplementation(multibrowser) {
if (multibrowser) {
// set implemenation
LiveDevImpl = MultiBrowserLiveDev;
// update styles for UI status
_status = [
{ tooltip: Strings.LIVE_DEV_STATUS_TIP_NOT_CONNECTED, style: "warning" },
... | javascript | {
"resource": ""
} |
q16874 | _setupDebugHelpers | train | function _setupDebugHelpers() {
window.ld = LiveDevelopment;
window.i = Inspector;
window.report = function report(params) { window.params = params; console.info(params); };
} | javascript | {
"resource": ""
} |
q16875 | checkIfAnotherSessionInProgress | train | function checkIfAnotherSessionInProgress() {
var result = $.Deferred();
if(updateJsonHandler) {
var state = updateJsonHandler.state;
updateJsonHandler.refresh()
.done(function() {
var val = updateJsonHandler.get(updateProgressKey);
... | javascript | {
"resource": ""
} |
q16876 | receiveMessageFromNode | train | function receiveMessageFromNode(event, msgObj) {
if (functionMap[msgObj.fn]) {
if(domainID === msgObj.requester) {
functionMap[msgObj.fn].apply(null, msgObj.args);
}
}
} | javascript | {
"resource": ""
} |
q16877 | postMessageToNode | train | function postMessageToNode(messageId) {
var msg = {
fn: messageId,
args: getFunctionArgs(arguments),
requester: domainID
};
updateDomain.exec('data', msg);
} | javascript | {
"resource": ""
} |
q16878 | checkInstallationStatus | train | function checkInstallationStatus() {
var searchParams = {
"updateDir": updateDir,
"installErrorStr": ["ERROR:"],
"bracketsErrorStr": ["ERROR:"],
"encoding": "utf8"
},
// Below are the possible Windows Installer error strings... | javascript | {
"resource": ""
} |
q16879 | checkUpdateStatus | train | function checkUpdateStatus() {
var filesToCache = ['.logs'],
downloadCompleted = updateJsonHandler.get("downloadCompleted"),
updateInitiatedInPrevSession = updateJsonHandler.get("updateInitiatedInPrevSession");
if (downloadCompleted && updateInitiatedInPrevSession) {
... | javascript | {
"resource": ""
} |
q16880 | handleInstallationStatus | train | function handleInstallationStatus(statusObj) {
var errorCode = "",
errorline = statusObj.installError;
if (errorline) {
errorCode = errorline.substr(errorline.lastIndexOf(':') + 2, errorline.length);
}
HealthLogger.sendAnalyticsData(
autoUpdateEventNam... | javascript | {
"resource": ""
} |
q16881 | initState | train | function initState() {
var result = $.Deferred();
updateJsonHandler.parse()
.done(function() {
result.resolve();
})
.fail(function (code) {
var logMsg;
switch (code) {
case StateHandlerMessages.FILE_NOT_F... | javascript | {
"resource": ""
} |
q16882 | setupAutoUpdate | train | function setupAutoUpdate() {
updateJsonHandler = new StateHandler(updateJsonPath);
updateDomain.on('data', receiveMessageFromNode);
updateDomain.exec('initNode', {
messageIds: MessageIds,
updateDir: updateDir,
requester: domainID
});
} | javascript | {
"resource": ""
} |
q16883 | initializeState | train | function initializeState() {
var result = $.Deferred();
FileSystem.resolve(updateDir, function (err) {
if (!err) {
result.resolve();
} else {
var directory = FileSystem.getDirectoryForPath(updateDir);
directory.create(function (err... | javascript | {
"resource": ""
} |
q16884 | initiateAutoUpdate | train | function initiateAutoUpdate(updateParams) {
_updateParams = updateParams;
downloadAttemptsRemaining = MAX_DOWNLOAD_ATTEMPTS;
initializeState()
.done(function () {
var setUpdateInProgress = function() {
var initNodeFn = function () {
... | javascript | {
"resource": ""
} |
q16885 | resetStateInFailure | train | function resetStateInFailure(message) {
updateJsonHandler.reset();
UpdateInfoBar.showUpdateBar({
type: "error",
title: Strings.UPDATE_FAILED,
description: ""
});
enableCheckForUpdateEntry(true);
console.error(message);
} | javascript | {
"resource": ""
} |
q16886 | setUpdateStateInJSON | train | function setUpdateStateInJSON(key, value) {
var result = $.Deferred();
updateJsonHandler.set(key, value)
.done(function () {
result.resolve();
})
.fail(function () {
resetStateInFailure("AutoUpdate : Could not modify updatehelper.json... | javascript | {
"resource": ""
} |
q16887 | handleSafeToDownload | train | function handleSafeToDownload() {
var downloadFn = function () {
if (isFirstIterationDownload()) {
// For the first iteration of download, show download
//status info in Status bar, and pass download to node
UpdateStatus.showUpdateStatus("initial-downl... | javascript | {
"resource": ""
} |
q16888 | attemptToDownload | train | function attemptToDownload() {
if (checkIfOnline()) {
postMessageToNode(MessageIds.PERFORM_CLEANUP, ['.json'], true);
} else {
enableCheckForUpdateEntry(true);
UpdateStatus.cleanUpdateStatus();
HealthLogger.sendAnalyticsData(
autoUpdateEven... | javascript | {
"resource": ""
} |
q16889 | showStatusInfo | train | function showStatusInfo(statusObj) {
if (statusObj.target === "initial-download") {
HealthLogger.sendAnalyticsData(
autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_START,
"autoUpdate",
"download",
"started",
""
);
... | javascript | {
"resource": ""
} |
q16890 | showErrorMessage | train | function showErrorMessage(message) {
var analyticsDescriptionMessage = "";
switch (message) {
case _nodeErrorMessages.UPDATEDIR_READ_FAILED:
analyticsDescriptionMessage = "Update directory could not be read.";
break;
case _nodeErrorMessages.UPDATEDIR_CLEAN_FAILED... | javascript | {
"resource": ""
} |
q16891 | initiateUpdateProcess | train | function initiateUpdateProcess(formattedInstallerPath, formattedLogFilePath, installStatusFilePath) {
// Get additional update parameters on Mac : installDir, appName, and updateDir
function getAdditionalParams() {
var retval = {};
var installDir = FileUtils.getNativeBracketsDir... | javascript | {
"resource": ""
} |
q16892 | train | function () {
var infoObj = {
installerPath: formattedInstallerPath,
logFilePath: formattedLogFilePath,
installStatusFilePath: installStatusFilePath
};
if (brackets.platform === "mac") {
var additionalParams = getAdditi... | javascript | {
"resource": ""
} | |
q16893 | handleValidationStatus | train | function handleValidationStatus(statusObj) {
enableCheckForUpdateEntry(true);
UpdateStatus.cleanUpdateStatus();
if (statusObj.valid) {
// Installer is validated successfully
var statusValidFn = function () {
// Restart button click handler
... | javascript | {
"resource": ""
} |
q16894 | train | function () {
// Restart button click handler
var restartBtnClicked = function () {
HealthLogger.sendAnalyticsData(
autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART,
"autoUpdate",
... | javascript | {
"resource": ""
} | |
q16895 | train | function () {
HealthLogger.sendAnalyticsData(
autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART,
"autoUpdate",
"installNotification",
"installNow ",
"click"
... | javascript | {
"resource": ""
} | |
q16896 | handleDownloadFailure | train | function handleDownloadFailure(message) {
console.log("AutoUpdate : Download of latest installer failed in Attempt " +
(MAX_DOWNLOAD_ATTEMPTS - downloadAttemptsRemaining) + ".\n Reason : " + message);
if (downloadAttemptsRemaining) {
// Retry the downloading
attempt... | javascript | {
"resource": ""
} |
q16897 | registerBracketsFunctions | train | function registerBracketsFunctions() {
functionMap["brackets.notifyinitializationComplete"] = handleInitializationComplete;
functionMap["brackets.showStatusInfo"] = showStatusInfo;
functionMap["brackets.notifyDownloadSuccess"] = handleDownloadSuccess;
functionMap["br... | javascript | {
"resource": ""
} |
q16898 | inlineProvider | train | function inlineProvider(hostEditor, pos) {
var jsonFile, propInfo,
propQueue = [], // priority queue of propNames to try
langId = hostEditor.getLanguageForSelection().getId(),
supportedLangs = {
"css": true,
"scss": true,
"less"... | javascript | {
"resource": ""
} |
q16899 | getHealthData | train | function getHealthData() {
var result = new $.Deferred(),
oneTimeHealthData = {};
oneTimeHealthData.snapshotTime = Date.now();
oneTimeHealthData.os = brackets.platform;
oneTimeHealthData.userAgent = window.navigator.userAgent;
oneTimeHealthData.osLanguage = brackets.... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.