Skip to content

Commit

Permalink
Add support for autoHide delay per type #9
Browse files Browse the repository at this point in the history
  • Loading branch information
shyallegro committed Apr 30, 2019
1 parent 1bff46d commit baa2745
Show file tree
Hide file tree
Showing 4 changed files with 669 additions and 644 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ behaviour: {

/**
* Defines whether each notification will hide itself automatically after a timeout passes
* @type {number | false}
* support and object with a key per type defaulting to default key.
* @type {number | false | [{key: string]: number | false}}
*/
autoHide: 5000,

Expand Down Expand Up @@ -510,7 +511,7 @@ const notifierDefaultOptions: NotifierOptions = {
},
theme: 'material',
behaviour: {
autoHide: 5000,
autoHide: {default: 5000, info: 3000, error: false},
onClick: false,
onMouseover: 'pauseAutoHide',
showDismissButton: true,
Expand Down
134 changes: 67 additions & 67 deletions src/demo/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { NotifierModule, NotifierOptions } from './../lib/index';

import { AppComponent } from './app.component';

/**
* Custom angular notifier options
*/
const customNotifierOptions: NotifierOptions = {
position: {
horizontal: {
position: 'left',
distance: 12
},
vertical: {
position: 'bottom',
distance: 12,
gap: 10
}
},
theme: 'material',
behaviour: {
autoHide: false,
onClick: false,
onMouseover: 'pauseAutoHide',
showDismissButton: true,
stacking: 4
},
animations: {
enabled: true,
show: {
preset: 'slide',
speed: 300,
easing: 'ease'
},
hide: {
preset: 'fade',
speed: 300,
easing: 'ease',
offset: 50
},
shift: {
speed: 300,
easing: 'ease'
},
overlap: 150
}
};

/**
* App module
*/
@NgModule( {
bootstrap: [
AppComponent
],
declarations: [
AppComponent
],
imports: [
BrowserModule,
NotifierModule.withConfig( customNotifierOptions )
]
} )
export class AppModule {}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { NotifierModule, NotifierOptions } from './../lib/index';

import { AppComponent } from './app.component';

/**
* Custom angular notifier options
*/
const customNotifierOptions: NotifierOptions = {
position: {
horizontal: {
position: 'left',
distance: 12
},
vertical: {
position: 'bottom',
distance: 12,
gap: 10
}
},
theme: 'material',
behaviour: {
autoHide: {default: 5000, info: 2000, success: 10000, error: false},
onClick: false,
onMouseover: 'pauseAutoHide',
showDismissButton: true,
stacking: 4
},
animations: {
enabled: true,
show: {
preset: 'slide',
speed: 300,
easing: 'ease'
},
hide: {
preset: 'fade',
speed: 300,
easing: 'ease',
offset: 50
},
shift: {
speed: 300,
easing: 'ease'
},
overlap: 150
}
};

/**
* App module
*/
@NgModule( {
bootstrap: [
AppComponent
],
declarations: [
AppComponent
],
imports: [
BrowserModule,
NotifierModule.withConfig( customNotifierOptions )
]
} )
export class AppModule {}
Loading

0 comments on commit baa2745

Please sign in to comment.