Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(function (resolve, reject) {
_this2.sequenceReject = resolve;
var last = sequence[sequence.length - 1];
last.options = last.options || last.o || {};
last.options.complete = function () {
if (!_this2.sequenceReject) return;
_this2.sequenceReject = undefined;
dispatch(PLATFORM.global, 'sequenceDone');
resolve();
};
try {
velocity.RunSequence(sequence);
} catch (e) {
_this2.stopSequence(sequence);
_this2.sequenceReject(e);
}
});
};
animateFieldFlash(fieldName) {
const fieldRef = this.refs[`${fieldName}Input`];
if (fieldRef) {
const { input } = fieldRef.refs;
const isFieldValid = this.props.validation.isFieldValid(fieldName);
const flashColor = isFieldValid ? "#f0fff4" : "#ffeeef";
Velocity.RunSequence([
{ e: input, p: { backgroundColor: flashColor }, o: { duration: 200 } },
{ e: input, p: { backgroundColor: "#fff" }, o: { duration: 100 } }
]);
}
}
return new Promise((resolve, reject) => {
this.sequenceReject = resolve;
let last = sequence[sequence.length - 1];
last.options = last.options || last.o || {};
last.options.complete = ()=> {
if (!this.sequenceReject) return;
this.sequenceReject = undefined;
dispatch(PLATFORM.global, 'sequenceDone');
resolve();
};
try {
velocity.RunSequence(sequence); //eslint-disable-line
} catch (e) {
this.stopSequence(sequence);
this.sequenceReject(e);
}
});
}
return new Promise((resolve, reject) => {
this.sequenceReject = resolve;
let last = sequence[sequence.length - 1];
last.options = last.options || last.o || {};
last.options.complete = ()=> {
if (!this.sequenceReject) return;
this.sequenceReject = undefined;
dispatch(PLATFORM.global, 'sequenceDone');
resolve();
};
try {
velocity.RunSequence(sequence); //eslint-disable-line
} catch (e) {
this.stopSequence(sequence);
this.sequenceReject(e);
}
});
}
}, () => {
if (this._input && this._input.refs.input) {
const { input } = this._input.refs;
Velocity.RunSequence([
{ e: input, p: { backgroundColor: "#e2f2e2" }, o: { duration: 200 } },
{ e: input, p: { backgroundColor: "#fff" }, o: { duration: 100 } }
]);
}
});
} else {
return new Promise((resolve, reject) => {
this.sequenceReject = resolve;
let last = sequence[sequence.length - 1];
last.options = last.options || last.o || {};
last.options.complete = () => {
if (!this.sequenceReject) return;
this.sequenceReject = undefined;
dispatch(PLATFORM.global, 'sequenceDone');
resolve();
};
try {
velocity.RunSequence(sequence);
} catch (e) {
this.stopSequence(sequence);
this.sequenceReject(e);
}
});
}
componentWillReceiveProps(nextProps) {
if (this._updated && this._saved && this.refs.autoSuggestInput) {
const input = this.refs.autoSuggestInput.input;
Velocity.RunSequence([
{ e: input, p: { backgroundColor: "#e2f2e2" }, o: { duration: 200 } },
{ e: input, p: { backgroundColor: "#fff" }, o: { duration: 100 } }
]);
this._updated = false;
}
if ((nextProps.tag.name !== this.props.tag.name)) {
this._updated = true;
}
}