<commit_before>/*
	@license Angular Snackbar version 1.0.0
	ⓒ 2015 <NAME> http://github.com/eu81273/angular.snackbar
	License: MIT

	<div class="snackbar-container" data-snackbar="true" data-snackbar-duration="3000" data-snackbar-remove-delay="200"></div>
*/

(function ( angular ) {
	"use strict";

	var module = angular.module( "angular.snackbar", [] );

	//snackbar service
	module.factory("snackbar", ['$rootScope', function ($rootScope) {

		return {
			create : function ( message, timeout ) { 

				$rootScope.$broadcast('createSnackbar', { 'message': message, 'timeout': timeout });
			}
		}
	}]);

	//snackbar directive
	module.directive( "snackbar", ["$rootScope", "$compile", "$timeout", function($rootScope, $compile, $timeout) {

		//snackbar duration time (ms)
		var snackbarDuration = 3000;

		//delay time to remove from DOM after hide (ms)
		var snackbarRemoveDelay = 200;

		return function ( scope, element, attrs ) {

			//initialize
			snackbarDuration = attrs.snackbarDuration || 3000;
			snackbarRemoveDelay = attrs.snackbarRemoveDelay || 200;

			$rootScope.$on('createSnackbar', function(event, received) {

				//snackbar template
				var template = "<div class=\"snackbar snackbar-opened\"><span class=\"snackbar-content\">" + received.message + "</span></div>";

				//template compile
				var snackbar = $compile(template)(scope);

				//add snackbar
				angular.element(element).append(snackbar);

				//snackbar duration timeout
				$timeout(function () {
					//hide snackbar
					return angular.element(snackbar).removeClass("snackbar-opened");

				}, received.timeout || snackbarDuration).then(function (element) {

					//remove snackbar
					$timeout( function () { element.remove(); }, snackbarRemoveDelay);
				});
			
			});
		};
	}]);

})(angular);<commit_msg>fix(*): Reduce extra digest loops when hide<commit_after>/*
	@license Angular Snackbar version 1.0.0
	ⓒ 2015 <NAME> http://github.com/eu81273/angular.snackbar
	License: MIT

	<div class="snackbar-container" data-snackbar="true" data-snackbar-duration="3000" data-snackbar-remove-delay="200"></div>
*/

(function ( angular ) {
	"use strict";

	var module = angular.module( "angular.snackbar", [] );

	//snackbar service
	module.factory("snackbar", ['$rootScope', function ($rootScope) {

		return {
			create : function ( message, timeout ) { 

				$rootScope.$broadcast('createSnackbar', { 'message': message, 'timeout': timeout });
			}
		}
	}]);

	//snackbar directive
	module.directive( "snackbar", ["$rootScope", "$compile", "$timeout", function($rootScope, $compile, $timeout) {

		//snackbar duration time (ms)
		var snackbarDuration = 3000;

		//delay time to remove from DOM after hide (ms)
		var snackbarRemoveDelay = 200;

		return function ( scope, element, attrs ) {

			//initialize
			snackbarDuration = attrs.snackbarDuration || 3000;
			snackbarRemoveDelay = attrs.snackbarRemoveDelay || 200;

			$rootScope.$on('createSnackbar', function(event, received) {

				//snackbar template
				var template = "<div class=\"snackbar snackbar-opened\"><span class=\"snackbar-content\">" + received.message + "</span></div>";

				//template compile
				var snackbar = $compile(template)(scope);

				//add snackbar
				angular.element(element).append(snackbar);

        //snackbar duration timeout
				var $snackbar = angular.element(snackbar);
				$timeout(function () {
					//hide snackbar
					$snackbar.removeClass("snackbar-opened");

					//remove snackbar
					$timeout( function () { $snackbar.remove(); }, snackbarRemoveDelay, false);
        }, received.timeout || snackbarDuration, false);
			
			});
		};
	}]);

})(angular);
{'fraction_non_alphanumeric': 0.16017553483269337, 'fraction_numerical': 0.018102029621503018, 'mean_word_length': 3.869158878504673, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4076158', 'n_tokens_mistral': 1376, 'n_tokens_neox': 1126, 'n_words': 250}