Skip to content

Commit 4fcab3b

Browse files
committed
feat(library): Extended API
- Added methods for hiding a specific, the newest or the oldest notification - Added method to clear all notifications - Introduced notification IDs - Updated dependencies, updated typings integration
1 parent bdec4ab commit 4fcab3b

13 files changed

+543
-178
lines changed

demo/app.component.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ import { NotifierService } from './../index';
1010
*/
1111
@Component( {
1212
selector: 'app',
13-
template: '<h1>Hello World</h1><button (click)="test()">Hit me</button><x-notifier-container></x-notifier-container>'
13+
template: `
14+
<h1>Hello World</h1>
15+
<button (click)="test()">Hit me</button>
16+
<button (click)="showSpecific()">Show specific</button>
17+
<button (click)="hideSpecific()">Hide specific</button>
18+
<button (click)="hideOldest()">Hide oldest</button>
19+
<button (click)="hideNewest()">Hide newest</button>
20+
<button (click)="hideAll()">Hide all</button>
21+
<x-notifier-container></x-notifier-container>
22+
`
1423
} )
1524
export class AppComponent {
1625

@@ -28,4 +37,28 @@ export class AppComponent {
2837
this.counter++;
2938
}
3039

40+
public showSpecific(): void {
41+
this.notifier.show( {
42+
id: 'ID_SPECIFIC',
43+
message: 'Specific notification here',
44+
type: 'test'
45+
} );
46+
}
47+
48+
public hideSpecific(): void {
49+
this.notifier.hide( 'ID_SPECIFIC' );
50+
}
51+
52+
public hideAll(): void {
53+
this.notifier.hideAll();
54+
}
55+
56+
public hideOldest(): void {
57+
this.notifier.hideOldest();
58+
}
59+
60+
public hideNewest(): void {
61+
this.notifier.hideNewest();
62+
}
63+
3164
}

gulp-tasks/typescript/typescript-build.task.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ gulp.task( 'typescript:build--dev', () => {
1414
let tsSourceProject = ts.createProject( './tsconfig.json' );
1515
let tsSourceResult = gulp
1616
.src( [
17-
'./src/**/*.ts', // Source files (except index file)
18-
'./typings/index.d.ts' // Include typings
17+
'./src/**/*.ts'
1918
] )
2019
.pipe( tsSourceProject( ts.reporter.defaultReporter() ) );
2120
let tsIndexProject = ts.createProject( './tsconfig.json' );
2221
let tsIndexResult = gulp
2322
.src( [
24-
'./index.ts', // Index file only
25-
'./typings/index.d.ts' // Include typings
23+
'./index.ts'
2624
] )
2725
.pipe( tsIndexProject( ts.reporter.defaultReporter() ) );
2826

@@ -47,9 +45,7 @@ gulp.task( 'typescript:build--prod', () => {
4745
.src( [
4846
'./**/*.ts', // Select everything to keep the folder structure alive
4947
'!./node_modules/**', // Ignore dependencies
50-
'!./demo/**', // Ignore demo
51-
'!./tyings/**', // Ignore typings ...
52-
'./typings/index.d.ts' // but include the typings entry (only)
48+
'!./demo/**' // Ignore demo
5349
] )
5450
.pipe( sourcemaps.init() )
5551
.pipe( tsProject( ts.reporter.defaultReporter() ) );
@@ -74,8 +70,7 @@ gulp.task( 'typescript:build--demo', () => {
7470
let tsProject = ts.createProject( './tsconfig.json' );
7571
let tsResults = gulp
7672
.src( [
77-
'./demo/*.ts',
78-
'./typings/index.d.ts'
73+
'./demo/*.ts'
7974
] )
8075
.pipe( tsProject() );
8176

package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@
3232
"js"
3333
],
3434
"main": "./index.js",
35-
"typings": "./index.d.ts",
35+
"types": "./index.d.ts",
3636
"scripts": {
37-
"gulp": "gulp",
38-
"typings": "typings"
37+
"gulp": "gulp"
3938
},
4039
"peerDependencies": {
4140
"@angular/core": "2.x",
@@ -49,23 +48,25 @@
4948
"@angular/compiler": "2.x",
5049
"@angular/platform-browser": "2.x",
5150
"@angular/platform-browser-dynamic": "2.x",
51+
"@types/core-js": "0.9.x",
52+
"@types/jasmine": "2.5.x",
5253
"browser-sync": "2.17.x",
53-
"codelyzer": "1.0.0-beta.2",
54+
"codelyzer": "1.0.0-beta.3",
5455
"conventional-github-releaser": "1.1.x",
5556
"conventional-recommended-bump": "0.3.x",
5657
"core-js": "2.4.x",
5758
"del": "2.2.x",
5859
"gulp": "github:gulpjs/gulp#4.0",
5960
"gulp-autoprefixer": "3.1.x",
60-
"gulp-bump": "2.4.x",
61+
"gulp-bump": "2.5.x",
6162
"gulp-conventional-changelog": "1.1.x",
62-
"gulp-git": "1.11.x",
63+
"gulp-git": "1.12.x",
6364
"gulp-insert": "0.5.x",
64-
"gulp-sourcemaps": "2.1.x",
65+
"gulp-sourcemaps": "2.2.x",
6566
"gulp-sass": "2.3.x",
6667
"gulp-sass-lint": "1.2.x",
6768
"gulp-tslint": "6.1.x",
68-
"gulp-typescript": "3.0.x",
69+
"gulp-typescript": "3.1.x",
6970
"gulp-util": "3.0.x",
7071
"jasmine-core": "2.5.x",
7172
"karma": "1.3.x",
@@ -80,7 +81,7 @@
8081
"systemjs": "0.19.x",
8182
"tslint": "3.15.x",
8283
"typescript": "2.0.x",
83-
"typings": "1.4.x",
84+
"typings": "1.5.x",
8485
"web-animations-js": "2.2.x",
8586
"zone.js": "0.6.x"
8687
}

0 commit comments

Comments
 (0)