Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check if function is async javascript

let promise = fnThatYouWannaCheck();

if(promise && typeof promise.then === 'function' 
   && promise[Symbol.toStringTag] === 'Promise')
{
  	// is compliant native promise implementation
}
else
{
  	throw new Error('async function expected');
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #function #async #javascript
ADD COMMENT
Topic
Name
2+4 =