Skip to content

Commit

Permalink
added hide method
Browse files Browse the repository at this point in the history
  • Loading branch information
chenkie committed Aug 5, 2016
1 parent c4e7b57 commit 0052ad6
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions angular-lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,24 @@
var lock = {};

function safeApply(fn) {
var phase = $rootScope.$root.$$phase;
if(phase === '$apply' || phase === '$digest') {
if(fn && (typeof(fn) === 'function')) {
fn();
}
} else {
$rootScope.$apply(fn);
var phase = $rootScope.$root.$$phase;
if(phase === '$apply' || phase === '$digest') {
if(fn && (typeof(fn) === 'function')) {
fn();
}
} else {
$rootScope.$apply(fn);
}
}

lock.show = function() {
Lock.show();
}

lock.hide = function() {
Lock.hide();
}

lock.on = function(event, cb) {
var lockEvents = ['show', 'hide', 'error', 'authenticated', 'authorization_error'];
if(lockEvents.indexOf(event) !== -1) {
Expand All @@ -60,7 +64,9 @@
});
});
}

return lock;

}
}
})();

0 comments on commit 0052ad6

Please sign in to comment.