1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 02:09:32 +02:00
OpenSTF/res/app/components/stf/common-ui/safe-apply/index.js
Gunther Brunner 593e14a80a - New nav menu.
- Polishing device list.
2014-03-25 21:18:10 +09:00

20 lines
575 B
JavaScript

module.exports = angular.module('stf.safe-apply', [])
.config([
'$provide', function ($provide) {
return $provide.decorator('$rootScope', [
'$delegate', function ($delegate) {
$delegate.safeApply = function (fn) {
var phase = $delegate.$$phase
if (phase === "$apply" || phase === "$digest") {
if (fn && typeof fn === 'function') {
fn()
}
} else {
$delegate.$apply(fn)
}
}
return $delegate
}
])
}
])