| 
									
										
										
										
											2017-02-14 16:19:21 -07:00
										 |  |  | ;(function () { | 
					
						
							|  |  |  | 'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | angular | 
					
						
							| 
									
										
										
										
											2017-02-27 18:19:01 -07:00
										 |  |  |   .module('org.oauth3', []) | 
					
						
							| 
									
										
										
										
											2017-02-14 16:19:21 -07:00
										 |  |  |   .service('Oauth3', [ | 
					
						
							|  |  |  |     '$timeout' | 
					
						
							|  |  |  |   , '$q' | 
					
						
							|  |  |  |   , function Oauth3($timeout, $q) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     var OAUTH3 = window.OAUTH3; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // We need to make angular's $q appear to be a standard Promise/A+
 | 
					
						
							|  |  |  |     // fortunately, this is pretty easy
 | 
					
						
							|  |  |  |     function PromiseAngularQ(fn) { | 
					
						
							|  |  |  |       var d = $q.defer(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-20 13:40:29 -06:00
										 |  |  |       //$timeout(function () {
 | 
					
						
							| 
									
										
										
										
											2017-02-14 16:19:21 -07:00
										 |  |  |         fn(d.resolve, d.reject); | 
					
						
							| 
									
										
										
										
											2017-03-20 13:40:29 -06:00
										 |  |  |       //}, 0);
 | 
					
						
							| 
									
										
										
										
											2017-02-14 16:19:21 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |       //this.then = d.promise.then;
 | 
					
						
							|  |  |  |       //this.catch = d.promise.catch;
 | 
					
						
							|  |  |  |       return d.promise; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //PromiseAngularQ.create = PromiseAngularQ;
 | 
					
						
							|  |  |  |     PromiseAngularQ.resolve = $q.when; | 
					
						
							|  |  |  |     PromiseAngularQ.reject = $q.reject; | 
					
						
							|  |  |  |     PromiseAngularQ.all = $q.all; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     OAUTH3.PromiseA = PromiseAngularQ; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     window.ngOauth3 = OAUTH3; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return OAUTH3; | 
					
						
							|  |  |  |   }]); | 
					
						
							|  |  |  | }()); |