util.isAsyncFunction(obj)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Returns true if the obj parameter is a JavaScript AsyncFunction and false otherwise.

Returns

boolean

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/util Module

Since

2020.1

Parameters

Parameter

Type

Required / Optional

Description

Since

obj

Object | Primitive

required

Object for which you want to verify the type.

2020.1

Syntax
Important:

The following code snippet shows the syntax for this member. It is not a functional example. For a full script sample, see N/util Module Script Sample.

Also note that the async keyword is used in this sample, which is only supported in SuiteScript 2.1.

          //Add additional code 
...
function func1(){
    var x = 1;
}
var func2 = function(){};
            
async function async1(){
   var x = 2;
}
    
var async2 = async function(){};

var a = util.isAsyncFunction(func1);  // function returns false (a = false)
var b = util.isAsynFunction(func2);   // function returns false (b = false)
var c = util.isAsyncFunction(async1); // function returns true (c = true)
var d = util.isAsyncFunction(async2)  // function returns true (d = true)
...
//Add additional code 

        

Related Topics

N/util Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices