Skip to content

Commit baa2745

Browse files
committed
Add support for autoHide delay per type #9
1 parent 1bff46d commit baa2745

File tree

4 files changed

+669
-644
lines changed

4 files changed

+669
-644
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,8 @@ behaviour: {
324324

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

@@ -510,7 +511,7 @@ const notifierDefaultOptions: NotifierOptions = {
510511
},
511512
theme: 'material',
512513
behaviour: {
513-
autoHide: 5000,
514+
autoHide: {default: 5000, info: 3000, error: false},
514515
onClick: false,
515516
onMouseover: 'pauseAutoHide',
516517
showDismissButton: true,

src/demo/app.module.ts

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
1-
import { NgModule } from '@angular/core';
2-
import { BrowserModule } from '@angular/platform-browser';
3-
4-
import { NotifierModule, NotifierOptions } from './../lib/index';
5-
6-
import { AppComponent } from './app.component';
7-
8-
/**
9-
* Custom angular notifier options
10-
*/
11-
const customNotifierOptions: NotifierOptions = {
12-
position: {
13-
horizontal: {
14-
position: 'left',
15-
distance: 12
16-
},
17-
vertical: {
18-
position: 'bottom',
19-
distance: 12,
20-
gap: 10
21-
}
22-
},
23-
theme: 'material',
24-
behaviour: {
25-
autoHide: false,
26-
onClick: false,
27-
onMouseover: 'pauseAutoHide',
28-
showDismissButton: true,
29-
stacking: 4
30-
},
31-
animations: {
32-
enabled: true,
33-
show: {
34-
preset: 'slide',
35-
speed: 300,
36-
easing: 'ease'
37-
},
38-
hide: {
39-
preset: 'fade',
40-
speed: 300,
41-
easing: 'ease',
42-
offset: 50
43-
},
44-
shift: {
45-
speed: 300,
46-
easing: 'ease'
47-
},
48-
overlap: 150
49-
}
50-
};
51-
52-
/**
53-
* App module
54-
*/
55-
@NgModule( {
56-
bootstrap: [
57-
AppComponent
58-
],
59-
declarations: [
60-
AppComponent
61-
],
62-
imports: [
63-
BrowserModule,
64-
NotifierModule.withConfig( customNotifierOptions )
65-
]
66-
} )
67-
export class AppModule {}
1+
import { NgModule } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
4+
import { NotifierModule, NotifierOptions } from './../lib/index';
5+
6+
import { AppComponent } from './app.component';
7+
8+
/**
9+
* Custom angular notifier options
10+
*/
11+
const customNotifierOptions: NotifierOptions = {
12+
position: {
13+
horizontal: {
14+
position: 'left',
15+
distance: 12
16+
},
17+
vertical: {
18+
position: 'bottom',
19+
distance: 12,
20+
gap: 10
21+
}
22+
},
23+
theme: 'material',
24+
behaviour: {
25+
autoHide: {default: 5000, info: 2000, success: 10000, error: false},
26+
onClick: false,
27+
onMouseover: 'pauseAutoHide',
28+
showDismissButton: true,
29+
stacking: 4
30+
},
31+
animations: {
32+
enabled: true,
33+
show: {
34+
preset: 'slide',
35+
speed: 300,
36+
easing: 'ease'
37+
},
38+
hide: {
39+
preset: 'fade',
40+
speed: 300,
41+
easing: 'ease',
42+
offset: 50
43+
},
44+
shift: {
45+
speed: 300,
46+
easing: 'ease'
47+
},
48+
overlap: 150
49+
}
50+
};
51+
52+
/**
53+
* App module
54+
*/
55+
@NgModule( {
56+
bootstrap: [
57+
AppComponent
58+
],
59+
declarations: [
60+
AppComponent
61+
],
62+
imports: [
63+
BrowserModule,
64+
NotifierModule.withConfig( customNotifierOptions )
65+
]
66+
} )
67+
export class AppModule {}

0 commit comments

Comments
 (0)