mirror of
				https://github.com/AmberGraceRblx/luau-promise.git
				synced 2025-11-04 12:09:17 +00:00 
			
		
		
		
	
						commit
						168239707b
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -32,7 +32,7 @@ local myFunction()
 | 
			
		|||
	return Promise.new(function(resolve, reject, onCancel)
 | 
			
		||||
		local connection
 | 
			
		||||
 | 
			
		||||
		someEvent:Connect(function(...)
 | 
			
		||||
		connection = someEvent:Connect(function(...)
 | 
			
		||||
			connection:Disconnect()
 | 
			
		||||
			resolve(...)
 | 
			
		||||
		end)
 | 
			
		||||
| 
						 | 
				
			
			@ -179,4 +179,4 @@ If a cancelled Promise has any consumers itself, those Promises are also cancell
 | 
			
		|||
 | 
			
		||||
Resolving a Promise with a Promise will cause the resolving Promise to become a consumer of the chained Promise, so if the chained Promise becomes cancelled then the resolving Promise will also become cancelled.
 | 
			
		||||
 | 
			
		||||
If you call `resolve` with a Promise within a Promise which is already cancelled, the passed Promise will be cancelled if it has no other consumers as an optimization.
 | 
			
		||||
If you call `resolve` with a Promise within a Promise which is already cancelled, the passed Promise will be cancelled if it has no other consumers as an optimization.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue