Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
watchedFiles[file].forEach(function(assembly) {
promises.push(new Promise(function(resolve, reject) {
touch(assembly, function() {
resolve();
});
}));
});
// Remove references to the file but don't unwatch it
delete watchedFiles[file];
}
// Add events always fire a change event for the same file, so we'll ignore add events
if (event !== 'add') {
// The file is done touching any parent files
Promise.all(promises).then(function() {
touchedFiles++;
// fire the event once all filesToTouch and have been touched
if (filesToTouch > 0 && touchedFiles === filesToTouch) {
filesToTouch = 1; // always count the staring file
touchedFiles = 0;
touchEvents.emit('allTouched');
}
});
}
}
property: 'submission',
value: this.resource
});
return {
name: parent,
resource: resource
};
}
return null;
}));
}
});
// When all the parents have loaded, emit that to the onParents emitter.
Promise.all(parentsLoaded).then((parents: any) => this.onParents.emit(parents));
}
beforeSubmit() {
return NativePromise.all(this.getComponents().map((comp) => comp.beforeSubmit()));
}
setValue(value) {
const newValue = value || [];
const changed = this.hasChanged(newValue, this.dataValue);
this.dataValue = newValue;
if (this.component.image) {
this.loadingImages = [];
const images = Array.isArray(newValue) ? newValue : [newValue];
images.map((fileInfo) => {
if (fileInfo && Object.keys(fileInfo).length) {
this.loadingImages.push(this.loadImage(fileInfo));
}
});
if (this.loadingImages.length) {
NativePromise.all(this.loadingImages)
.then(() => {
this.refreshDOM();
setTimeout(() => this.filesReadyResolve(), 100);
})
.catch(() => this.filesReadyReject());
}
}
else {
this.refreshDOM();
this.filesReadyResolve();
}
return changed;
}
function successfulReviewFlow (review, resources) {
var inputs;
return Promise.all([review, resources])
.then(function (res) {
var review = res[0] || {};
var resources = res[1];
inputs = {
'reviewers': review.reviewers,
'resources': resources
};
var assignees = (review.reviewers || []).map(function (reviewer) {
return reviewer.login;
});
function liveRun() {
return github.assignUsersToResource(resources[0], assignees)
.then(function () {
collapsed: this.collapsed,
[this.nestedKey]: 'single',
});
let childPromise = NativePromise.resolve();
if (this.refs[this.nestedKey]) {
childPromise = this.attachComponents(this.refs[this.nestedKey]);
}
if (this.component.collapsible && this.refs.header) {
this.addEventListener(this.refs.header, 'click', () => {
this.collapsed = !this.collapsed;
});
}
return NativePromise.all([
superPromise,
childPromise,
]);
}
get dataReady() {
return NativePromise.all(this.getComponents().map((component) => component.dataReady));
}
get ready() {
return NativePromise.all(this.getComponents().map(component => component.ready));
}
container = container || this.component.components;
element = this.hook('attachComponents', element, components, container, this);
if (!element) {
return;
}
let index = 0;
const promises = [];
Array.prototype.slice.call(element.children).forEach(child => {
if (!child.getAttribute('data-noattach') && components[index]) {
promises.push(components[index].attach(child));
index++;
}
});
return NativePromise.all(promises);
}
function getGithubResources (githubURLs) {
var githubResources = githubURLs.map(function (uo) {
return parseGithubPath(uo.path);
});
return Promise.all(githubResources.map(fetchGithubResourceData));
}