Skip to content

Commit

Permalink
Release v0.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
flippinjoe committed Jun 17, 2015
1 parent 6b600a2 commit cf20cdb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
],
"name": "angular-growl-v2",
"description": "growl like notifications for angularJS projects, using bootstrap alert classes",
"version": "0.7.4",
"version": "0.7.5",
"homepage": "http://janstevens.github.io/angular-growl-2",
"repository": {
"type": "git",
Expand Down
23 changes: 15 additions & 8 deletions build/angular-growl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* angular-growl-v2 - v0.7.4 - 2015-05-26
* angular-growl-v2 - v0.7.4 - 2015-06-17
* http://janstevens.github.io/angular-growl-2
* Copyright (c) 2015 Marco Rinck,Jan Stevens; Licensed MIT
*/
Expand Down Expand Up @@ -250,7 +250,7 @@ angular.module('angular-growl').provider('growl', function () {
}
function general(text, config, severity) {
severity = (severity || 'error').toLowerCase();
sendMessage(text, config, severity);
return sendMessage(text, config, severity);
}
function addServerMessages(messages) {
if (!messages || !messages.length) {
Expand Down Expand Up @@ -301,6 +301,7 @@ angular.module('angular-growl').service('growlMessages', [
'$timeout',
function ($sce, $timeout) {
'use strict';
var self = this;
this.directives = {};
var preloadDirectives = {};
function preLoad(referenceId) {
Expand All @@ -312,6 +313,10 @@ angular.module('angular-growl').service('growlMessages', [
}
return directive;
}
function directiveForRefId(referenceId) {
var refId = referenceId || 0;
return self.directives[refId] || preloadDirectives[refId];
}
this.initDirective = function (referenceId, limitMessages) {
if (preloadDirectives[referenceId]) {
this.directives[referenceId] = preloadDirectives[referenceId];
Expand All @@ -327,8 +332,8 @@ angular.module('angular-growl').service('growlMessages', [
this.getAllMessages = function (referenceId) {
referenceId = referenceId || 0;
var messages;
if (this.directives[referenceId]) {
messages = this.directives[referenceId].messages;
if (directiveForRefId(referenceId)) {
messages = directiveForRefId(referenceId).messages;
} else {
messages = [];
}
Expand All @@ -339,8 +344,9 @@ angular.module('angular-growl').service('growlMessages', [
for (var i = messages.length - 1; i >= 0; i--) {
messages[i].destroy();
}
if (this.directives[referenceId]) {
this.directives[referenceId].messages = [];
var directive = directiveForRefId(referenceId);
if (directive) {
directive.messages = [];
}
};
this.addMessage = function (message) {
Expand Down Expand Up @@ -391,15 +397,16 @@ angular.module('angular-growl').service('growlMessages', [
message.onopen();
}
if (message.ttl && message.ttl !== -1) {
var self = this;
message.promises.push($timeout(angular.bind(this, function () {
this.deleteMessage(message);
self.deleteMessage(message);
}), message.ttl));
message.promises.push($timeout(message.countdownFunction, 1000));
}
return message;
};
this.deleteMessage = function (message) {
var messages = this.directives[message.referenceId].messages, index = messages.indexOf(message);
var messages = this.getAllMessages(message.referenceId), index = messages.indexOf(message);
if (index > -1) {
messages[index].close = true;
messages.splice(index, 1);
Expand Down
4 changes: 2 additions & 2 deletions build/angular-growl.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-growl-v2",
"version": "0.7.4",
"version": "0.7.5",
"description": "growl like notifications for angularJS projects, using bootstrap alert classes",
"repository": {
"type": "git",
Expand Down

0 comments on commit cf20cdb

Please sign in to comment.