blob: 37458a61b2b87a67b1640fd9646f95a2e732c509 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/**
* ownCloud - News
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
app.directive('newsTimeout', function ($timeout) {
'use strict';
return {
restrict: 'A',
scope: {
'newsTimeout': '&'
},
link: function (scope) {
var seconds = 7;
var timer = $timeout(scope.newsTimeout, seconds * 1000);
// remove timeout if element is being removed by
// for instance clicking on the x button
scope.$on('$destroy', function () {
$timeout.cancel(timer);
});
}
};
});
|