Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
openErrorSnackbar(errorMessage: string) {
const config = new MatSnackBarConfig();
// config.duration = 1000;
config.data = {type: 'error', message: errorMessage};
this.snackbar.openFromComponent(SnackbarComponent, config);
}
}
private runCarousel(): void {
if (this.snackbarOpened) {
if (!this.actuallyDisplayedNotification.force && this.snackBarNotificationsForceQueue.size() > 0) {
this.snackBar.dismiss();
}
return;
}
this.loadNotificationToDisplay();
if (this.actuallyDisplayedNotification == null) {
return;
}
this.snackbarOpened = true;
const config: MatSnackBarConfig = new MatSnackBarConfig();
config.duration = 1000 * this.actuallyDisplayedNotification.duration;
const callback = this.actuallyDisplayedNotification.callback;
this.snackBar.open(this.actuallyDisplayedNotification.message, this.actuallyDisplayedNotification.action, config).afterDismissed().subscribe(() => {
if (callback) {
callback();
}
this.snackbarOpened = false;
this.runCarousel();
});
}
}
private _createConfig() {
const config = new MatSnackBarConfig();
config.verticalPosition = this.verticalPosition;
config.horizontalPosition = this.horizontalPosition;
config.duration = this.setAutoHide ? this.autoHide : 0;
config.panelClass = this.addExtraClass ? ['demo-party'] : undefined;
config.direction = this.dir.value;
return config;
}
}
open(message: string, type?: string, action?: string): void {
const config = new MatSnackBarConfig();
config.duration = (
['err', 'warn'].includes(type) ? 10000 :
'info' === type ? 5000 : 2000);
this.snackBar.open(message, action ? action : 'Dismiss', config);
}
constructor(private snackBar: MatSnackBar) {
this.config = new MatSnackBarConfig();
this.config.duration = 3000;
}
resetPassword() {
const successMessage = 'Password reset instructions sent';
const errorMessage = 'An error occurred sending the instructions email';
const snackbarConfig = new MatSnackBarConfig();
snackbarConfig.duration = fiveSeconds;
snackbarConfig.panelClass = 'mycroft-no-action-snackbar';
this.authService.resetPassword(this.passwordResetForm.controls['email']).subscribe(
() => { this.snackBar.open(successMessage, null, snackbarConfig); },
() => { this.snackBar.open(errorMessage, null, snackbarConfig); }
);
}
}
openErrorSnackbar() {
const config = new MatSnackBarConfig();
config.data = {
type: 'error',
message: 'Error saving changes to ' + this.skill.name + ' settings'
};
this.snackbar.openFromComponent(SnackbarComponent, config);
}
showSimpleToast() {
let config = new MatSnackBarConfig();
config.duration = this.durationHide;
this.snackBar.open(this.message, this.action && this.actionButtonLabel, config);
}