New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ng2-toasty

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-toasty - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

36

bundles/ng2-toasty.js

@@ -32,3 +32,3 @@ System.registerDynamic("src/toasty.utils", [], true, function ($__require, exports, module) {

});
System.registerDynamic("src/toasty.service", ["@angular/core", "./toasty.utils", "rxjs/Observable"], true, function ($__require, exports, module) {
System.registerDynamic("src/toasty.service", ["@angular/core", "./toasty.utils"], true, function ($__require, exports, module) {
// Copyright (C) 2016 Sergey Akopkokhyants

@@ -54,3 +54,2 @@ // This project is licensed under the terms of the MIT license.

var toasty_utils_1 = $__require("./toasty.utils");
var Observable_1 = $__require("rxjs/Observable");
/**

@@ -83,12 +82,9 @@ * Default configuration foa all toats and toasty container

function ToastyService(config) {
var _this = this;
this.config = config;
// Init the counter
this.uniqueCounter = 0;
this.toastsObservable = new Observable_1.Observable(function (subscriber) {
_this.toastsSubscriber = subscriber;
});
this.clearObservable = new Observable_1.Observable(function (subscriber) {
_this.clearSubscriber = subscriber;
});
// ToastData event emitter
this.toastsEmitter = new core_1.EventEmitter();
// Clear event emitter
this.clearEmitter = new core_1.EventEmitter();
}

@@ -99,6 +95,6 @@ /**

ToastyService.prototype.getToasts = function () {
return this.toastsObservable;
return this.toastsEmitter.asObservable();
};
ToastyService.prototype.getClear = function () {
return this.clearObservable;
return this.clearEmitter.asObservable();
};

@@ -185,11 +181,7 @@ /**

// Push up a new toast item
try {
this.toastsSubscriber.next(toast);
// If we have a onAdd function, call it here
if (toastyOptions.onAdd && toasty_utils_1.isFunction(toastyOptions.onAdd)) {
toastyOptions.onAdd.call(this, toast);
}
} catch (e) {
console.log(e);
console.log('!!! Suggestion: Seems you forget add <ng2-toasty></ng2-toasty> into your html?');
// this.toastsSubscriber.next(toast);
this.toastsEmitter.next(toast);
// If we have a onAdd function, call it here
if (toastyOptions.onAdd && toasty_utils_1.isFunction(toastyOptions.onAdd)) {
toastyOptions.onAdd.call(this, toast);
}

@@ -199,7 +191,7 @@ };

ToastyService.prototype.clearAll = function () {
this.clearSubscriber.next(null);
this.clearEmitter.next(null);
};
// Clear the specific one
ToastyService.prototype.clear = function (id) {
this.clearSubscriber.next(id);
this.clearEmitter.next(id);
};

@@ -206,0 +198,0 @@ // Checks whether the local option is set, if not,

@@ -1,2 +0,2 @@

System.registerDynamic("src/toasty.utils",[],!0,function(t,e,o){"use strict";function n(t){return"string"==typeof t}function s(t){return"number"==typeof t}function i(t){return"function"==typeof t}this||self;return e.isString=n,e.isNumber=s,e.isFunction=i,o.exports}),System.registerDynamic("src/toasty.service",["@angular/core","./toasty.utils","rxjs/Observable"],!0,function(t,e,o){"use strict";var n=(this||self,this&&this.__decorate||function(t,e,o,n){var s,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(i<3?s(r):i>3?s(e,o,r):s(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r}),s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=t("@angular/core"),r=t("./toasty.utils"),a=t("rxjs/Observable"),c=function(){function t(){this.limit=5,this.showClose=!0,this.position="bottom-right",this.timeout=5e3,this.theme="default"}return t=n([i.Injectable(),s("design:paramtypes",[])],t)}();e.ToastyConfig=c;var u=function(){function t(t){var e=this;this.config=t,this.uniqueCounter=0,this.toastsObservable=new a.Observable(function(t){e.toastsSubscriber=t}),this.clearObservable=new a.Observable(function(t){e.clearSubscriber=t})}return t.prototype.getToasts=function(){return this.toastsObservable},t.prototype.getClear=function(){return this.clearObservable},t.prototype.default=function(t){this.add(t,"default")},t.prototype.info=function(t){this.add(t,"info")},t.prototype.success=function(t){this.add(t,"success")},t.prototype.wait=function(t){this.add(t,"wait")},t.prototype.error=function(t){this.add(t,"error")},t.prototype.warning=function(t){this.add(t,"warning")},t.prototype.add=function(e,o){var n;if(n=r.isString(e)&&""!==e||r.isNumber(e)?{title:e.toString()}:e,!n||!n.title&&!n.msg)throw new Error("ng2-toasty: No toast title or message specified!");o=o||"default",this.uniqueCounter++;var s,i=this._checkConfigItem(this.config,n,"showClose");s=n.theme&&t.THEMES.indexOf(n.theme)>-1?n.theme:this.config.theme;var a={id:this.uniqueCounter,title:n.title,msg:n.msg,showClose:i,type:"toasty-type-"+o,theme:"toasty-theme-"+s,onAdd:n.onAdd&&r.isFunction(n.onAdd)?n.onAdd:null,onRemove:n.onRemove&&r.isFunction(n.onRemove)?n.onRemove:null};a.timeout=n.hasOwnProperty("timeout")?n.timeout:this.config.timeout;try{this.toastsSubscriber.next(a),n.onAdd&&r.isFunction(n.onAdd)&&n.onAdd.call(this,a)}catch(t){console.log(t),console.log("!!! Suggestion: Seems you forget add <ng2-toasty></ng2-toasty> into your html?")}},t.prototype.clearAll=function(){this.clearSubscriber.next(null)},t.prototype.clear=function(t){this.clearSubscriber.next(t)},t.prototype._checkConfigItem=function(t,e,o){return e[o]!==!1&&(!!e[o]||t[o])},t.THEMES=["default","material","bootstrap"],t=n([i.Injectable(),s("design:paramtypes",[c])],t)}();return e.ToastyService=u,o.exports}),System.registerDynamic("src/toasty.component",["@angular/core","./toasty.utils","./toasty.service"],!0,function(t,e,o){"use strict";var n=(this||self,this&&this.__decorate||function(t,e,o,n){var s,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(i<3?s(r):i>3?s(e,o,r):s(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r}),s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=t("@angular/core"),r=t("./toasty.utils"),a=t("./toasty.service"),c=function(){function t(t,e){this.config=t,this.toastyService=e,this._position="",this.toasts=[],this.position=""}return Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){if(e){for(var o=!0,n=0;n<t.POSITIONS.length;n++)if(t.POSITIONS[n]===e){o=!1;break}o&&(e=this.config.position)}else e=this.config.position;this._position="toasty-position-"+e},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this.toastyService.getToasts().subscribe(function(e){t.toasts.length>=t.config.limit&&t.toasts.shift(),t.toasts.push(e),e.timeout&&t._setTimeout(e)}),this.toastyService.getClear().subscribe(function(e){e&&t.clear(e),t.clearAll()})},t.prototype.closeToast=function(t){this.clear(t.id)},t.prototype.clear=function(t){var e=this;if(!t)throw new Error("Please provide id of Toast to close");this.toasts.forEach(function(o,n){o.id===t&&(o.onRemove&&r.isFunction(o.onRemove)&&o.onRemove.call(e,o),e.toasts.splice(n,1))})},t.prototype.clearAll=function(){var t=this;this.toasts.forEach(function(e,o){e.onRemove&&r.isFunction(e.onRemove)&&e.onRemove.call(t,e)}),this.toasts=[]},t.prototype._setTimeout=function(t){var e=this;window.setTimeout(function(){e.clear(t.id)},t.timeout)},t.POSITIONS=["bottom-right","bottom-left","top-right","top-left","top-center","bottom-center"],n([i.Input(),s("design:type",String),s("design:paramtypes",[String])],t.prototype,"position",null),t=n([i.Component({moduleId:o.id.toString(),selector:"ng2-toasty",template:'\n <div id="toasty" [ngClass]="[position]">\n <ng2-toast *ngFor="let toast of toasts" [toast]="toast" (closeToast)="closeToast(toast)"></ng2-toast>\n </div>'}),s("design:paramtypes",[a.ToastyConfig,a.ToastyService])],t)}();return e.ToastyComponent=c,o.exports}),System.registerDynamic("src/toast.component",["@angular/core"],!0,function(t,e,o){"use strict";var n=(this||self,this&&this.__decorate||function(t,e,o,n){var s,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(i<3?s(r):i>3?s(e,o,r):s(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r}),s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=t("@angular/core"),r=function(){function t(){this.closeToastEvent=new i.EventEmitter}return t.prototype.close=function(t){t.preventDefault(),this.closeToastEvent.next(this.toast)},n([i.Input(),s("design:type",Object)],t.prototype,"toast",void 0),n([i.Output("closeToast"),s("design:type",Object)],t.prototype,"closeToastEvent",void 0),t=n([i.Component({moduleId:o.id.toString(),selector:"ng2-toast",template:'\n <div class="toast" [ngClass]="[toast.type, toast.theme]">\n <div *ngIf="toast.showClose" class="close-button" (click)="close($event)"></div>\n <div *ngIf="toast.title || toast.msg" class="toast-text">\n <span *ngIf="toast.title" class="toast-title">{{toast.title}}</span>\n <br *ngIf="toast.title && toast.msg" />\n <span *ngIf="toast.msg" class="toast-msg">{{toast.msg}}</span>\n </div>\n </div>'}),s("design:paramtypes",[])],t)}();return e.ToastComponent=r,o.exports}),System.registerDynamic("index",["@angular/core","@angular/common","./src/toasty.service","./src/toasty.component","./src/toast.component"],!0,function(t,e,o){"use strict";function n(t){for(var o in t)e.hasOwnProperty(o)||(e[o]=t[o])}var s=(this||self,this&&this.__decorate||function(t,e,o,n){var s,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(i<3?s(r):i>3?s(e,o,r):s(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r}),i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=t("@angular/core"),a=t("@angular/common");n(t("./src/toasty.service")),n(t("./src/toasty.component"));var c=t("./src/toasty.component"),u=t("./src/toast.component"),l=t("./src/toasty.service");Object.defineProperty(e,"__esModule",{value:!0}),e.default={providers:[l.ToastyConfig,l.ToastyService],directives:[c.ToastyComponent,u.ToastComponent]};var f=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[l.ToastyConfig,l.ToastyService]}},t=s([r.NgModule({imports:[a.CommonModule],declarations:[u.ToastComponent,c.ToastyComponent],exports:[u.ToastComponent,c.ToastyComponent]}),i("design:paramtypes",[])],t)}();return e.ToastyModule=f,o.exports});
System.registerDynamic("src/toasty.utils",[],!0,function(t,e,o){"use strict";function n(t){return"string"==typeof t}function s(t){return"number"==typeof t}function i(t){return"function"==typeof t}this||self;return e.isString=n,e.isNumber=s,e.isFunction=i,o.exports}),System.registerDynamic("src/toasty.service",["@angular/core","./toasty.utils"],!0,function(t,e,o){"use strict";var n=(this||self,this&&this.__decorate||function(t,e,o,n){var s,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(i<3?s(r):i>3?s(e,o,r):s(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r}),s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=t("@angular/core"),r=t("./toasty.utils"),a=function(){function t(){this.limit=5,this.showClose=!0,this.position="bottom-right",this.timeout=5e3,this.theme="default"}return t=n([i.Injectable(),s("design:paramtypes",[])],t)}();e.ToastyConfig=a;var c=function(){function t(t){this.config=t,this.uniqueCounter=0,this.toastsEmitter=new i.EventEmitter,this.clearEmitter=new i.EventEmitter}return t.prototype.getToasts=function(){return this.toastsEmitter.asObservable()},t.prototype.getClear=function(){return this.clearEmitter.asObservable()},t.prototype.default=function(t){this.add(t,"default")},t.prototype.info=function(t){this.add(t,"info")},t.prototype.success=function(t){this.add(t,"success")},t.prototype.wait=function(t){this.add(t,"wait")},t.prototype.error=function(t){this.add(t,"error")},t.prototype.warning=function(t){this.add(t,"warning")},t.prototype.add=function(e,o){var n;if(n=r.isString(e)&&""!==e||r.isNumber(e)?{title:e.toString()}:e,!n||!n.title&&!n.msg)throw new Error("ng2-toasty: No toast title or message specified!");o=o||"default",this.uniqueCounter++;var s,i=this._checkConfigItem(this.config,n,"showClose");s=n.theme&&t.THEMES.indexOf(n.theme)>-1?n.theme:this.config.theme;var a={id:this.uniqueCounter,title:n.title,msg:n.msg,showClose:i,type:"toasty-type-"+o,theme:"toasty-theme-"+s,onAdd:n.onAdd&&r.isFunction(n.onAdd)?n.onAdd:null,onRemove:n.onRemove&&r.isFunction(n.onRemove)?n.onRemove:null};a.timeout=n.hasOwnProperty("timeout")?n.timeout:this.config.timeout,this.toastsEmitter.next(a),n.onAdd&&r.isFunction(n.onAdd)&&n.onAdd.call(this,a)},t.prototype.clearAll=function(){this.clearEmitter.next(null)},t.prototype.clear=function(t){this.clearEmitter.next(t)},t.prototype._checkConfigItem=function(t,e,o){return e[o]!==!1&&(!!e[o]||t[o])},t.THEMES=["default","material","bootstrap"],t=n([i.Injectable(),s("design:paramtypes",[a])],t)}();return e.ToastyService=c,o.exports}),System.registerDynamic("src/toasty.component",["@angular/core","./toasty.utils","./toasty.service"],!0,function(t,e,o){"use strict";var n=(this||self,this&&this.__decorate||function(t,e,o,n){var s,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(i<3?s(r):i>3?s(e,o,r):s(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r}),s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=t("@angular/core"),r=t("./toasty.utils"),a=t("./toasty.service"),c=function(){function t(t,e){this.config=t,this.toastyService=e,this._position="",this.toasts=[],this.position=""}return Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){if(e){for(var o=!0,n=0;n<t.POSITIONS.length;n++)if(t.POSITIONS[n]===e){o=!1;break}o&&(e=this.config.position)}else e=this.config.position;this._position="toasty-position-"+e},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this.toastyService.getToasts().subscribe(function(e){t.toasts.length>=t.config.limit&&t.toasts.shift(),t.toasts.push(e),e.timeout&&t._setTimeout(e)}),this.toastyService.getClear().subscribe(function(e){e&&t.clear(e),t.clearAll()})},t.prototype.closeToast=function(t){this.clear(t.id)},t.prototype.clear=function(t){var e=this;if(!t)throw new Error("Please provide id of Toast to close");this.toasts.forEach(function(o,n){o.id===t&&(o.onRemove&&r.isFunction(o.onRemove)&&o.onRemove.call(e,o),e.toasts.splice(n,1))})},t.prototype.clearAll=function(){var t=this;this.toasts.forEach(function(e,o){e.onRemove&&r.isFunction(e.onRemove)&&e.onRemove.call(t,e)}),this.toasts=[]},t.prototype._setTimeout=function(t){var e=this;window.setTimeout(function(){e.clear(t.id)},t.timeout)},t.POSITIONS=["bottom-right","bottom-left","top-right","top-left","top-center","bottom-center"],n([i.Input(),s("design:type",String),s("design:paramtypes",[String])],t.prototype,"position",null),t=n([i.Component({moduleId:o.id.toString(),selector:"ng2-toasty",template:'\n <div id="toasty" [ngClass]="[position]">\n <ng2-toast *ngFor="let toast of toasts" [toast]="toast" (closeToast)="closeToast(toast)"></ng2-toast>\n </div>'}),s("design:paramtypes",[a.ToastyConfig,a.ToastyService])],t)}();return e.ToastyComponent=c,o.exports}),System.registerDynamic("src/toast.component",["@angular/core"],!0,function(t,e,o){"use strict";var n=(this||self,this&&this.__decorate||function(t,e,o,n){var s,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(i<3?s(r):i>3?s(e,o,r):s(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r}),s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=t("@angular/core"),r=function(){function t(){this.closeToastEvent=new i.EventEmitter}return t.prototype.close=function(t){t.preventDefault(),this.closeToastEvent.next(this.toast)},n([i.Input(),s("design:type",Object)],t.prototype,"toast",void 0),n([i.Output("closeToast"),s("design:type",Object)],t.prototype,"closeToastEvent",void 0),t=n([i.Component({moduleId:o.id.toString(),selector:"ng2-toast",template:'\n <div class="toast" [ngClass]="[toast.type, toast.theme]">\n <div *ngIf="toast.showClose" class="close-button" (click)="close($event)"></div>\n <div *ngIf="toast.title || toast.msg" class="toast-text">\n <span *ngIf="toast.title" class="toast-title">{{toast.title}}</span>\n <br *ngIf="toast.title && toast.msg" />\n <span *ngIf="toast.msg" class="toast-msg">{{toast.msg}}</span>\n </div>\n </div>'}),s("design:paramtypes",[])],t)}();return e.ToastComponent=r,o.exports}),System.registerDynamic("index",["@angular/core","@angular/common","./src/toasty.service","./src/toasty.component","./src/toast.component"],!0,function(t,e,o){"use strict";function n(t){for(var o in t)e.hasOwnProperty(o)||(e[o]=t[o])}var s=(this||self,this&&this.__decorate||function(t,e,o,n){var s,i=arguments.length,r=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(r=(i<3?s(r):i>3?s(e,o,r):s(e,o))||r);return i>3&&r&&Object.defineProperty(e,o,r),r}),i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=t("@angular/core"),a=t("@angular/common");n(t("./src/toasty.service")),n(t("./src/toasty.component"));var c=t("./src/toasty.component"),f=t("./src/toast.component"),u=t("./src/toasty.service");Object.defineProperty(e,"__esModule",{value:!0}),e.default={providers:[u.ToastyConfig,u.ToastyService],directives:[c.ToastyComponent,f.ToastComponent]};var l=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[u.ToastyConfig,u.ToastyService]}},t=s([r.NgModule({imports:[a.CommonModule],declarations:[f.ToastComponent,c.ToastyComponent],exports:[f.ToastComponent,c.ToastyComponent]}),i("design:paramtypes",[])],t)}();return e.ToastyModule=l,o.exports});
//# sourceMappingURL=bundles/ng2-toasty.min.js.map
{
"name": "ng2-toasty",
"description": "Angular2 Toasty component shows growl-style alerts and messages for your web app",
"version": "2.0.0",
"version": "2.0.1",
"scripts": {

@@ -62,2 +62,2 @@ "test": "tsc && karma start",

}
}
}

@@ -88,3 +88,3 @@ # Angular 2 Toasty [![npm version](https://badge.fury.io/js/ng2-toasty.svg)](https://badge.fury.io/js/ng2-toasty) [![npm monthly downloads](https://img.shields.io/npm/dm/ng2-toasty.svg?style=flat-square)](https://www.npmjs.com/package/ng2-toasty)

import {Component} from '@angular/core';
import {ToastyService} from 'ng2-toasty';
import {ToastyService, ToastyConfig, ToastOptions, ToastData} from 'ng2-toasty';

@@ -91,0 +91,0 @@ @Component({

@@ -46,6 +46,4 @@ import { Observable } from 'rxjs/Observable';

uniqueCounter: number;
private toastsObservable;
private toastsSubscriber;
private clearObservable;
private clearSubscriber;
private toastsEmitter;
private clearEmitter;
constructor(config: ToastyConfig);

@@ -52,0 +50,0 @@ /**

@@ -16,3 +16,2 @@ // Copyright (C) 2016 Sergey Akopkokhyants

var toasty_utils_1 = require('./toasty.utils');
var Observable_1 = require('rxjs/Observable');
/**

@@ -48,12 +47,9 @@ * Default configuration foa all toats and toasty container

function ToastyService(config) {
var _this = this;
this.config = config;
// Init the counter
this.uniqueCounter = 0;
this.toastsObservable = new Observable_1.Observable(function (subscriber) {
_this.toastsSubscriber = subscriber;
});
this.clearObservable = new Observable_1.Observable(function (subscriber) {
_this.clearSubscriber = subscriber;
});
// ToastData event emitter
this.toastsEmitter = new core_1.EventEmitter();
// Clear event emitter
this.clearEmitter = new core_1.EventEmitter();
}

@@ -64,6 +60,6 @@ /**

ToastyService.prototype.getToasts = function () {
return this.toastsObservable;
return this.toastsEmitter.asObservable();
};
ToastyService.prototype.getClear = function () {
return this.clearObservable;
return this.clearEmitter.asObservable();
};

@@ -152,21 +148,16 @@ /**

// Push up a new toast item
try {
this.toastsSubscriber.next(toast);
// If we have a onAdd function, call it here
if (toastyOptions.onAdd && toasty_utils_1.isFunction(toastyOptions.onAdd)) {
toastyOptions.onAdd.call(this, toast);
}
// this.toastsSubscriber.next(toast);
this.toastsEmitter.next(toast);
// If we have a onAdd function, call it here
if (toastyOptions.onAdd && toasty_utils_1.isFunction(toastyOptions.onAdd)) {
toastyOptions.onAdd.call(this, toast);
}
catch (e) {
console.log(e);
console.log('!!! Suggestion: Seems you forget add <ng2-toasty></ng2-toasty> into your html?');
}
};
// Clear all toasts
ToastyService.prototype.clearAll = function () {
this.clearSubscriber.next(null);
this.clearEmitter.next(null);
};
// Clear the specific one
ToastyService.prototype.clear = function (id) {
this.clearSubscriber.next(id);
this.clearEmitter.next(id);
};

@@ -173,0 +164,0 @@ // Checks whether the local option is set, if not,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc