Skip to content

Sys.Call

boxgaming edited this page Jul 11, 2026 · 3 revisions

Calls a native JavaScript function.
Available in release 0.11.0

Syntax

result = Sys.Call ( func [, thisArg, arg1, arg2, ... _argN] )

OR

Sys.Call func [, thisArg, arg1, arg2, ... _argN]

Parameters

  • The func parameter specifies the native JavaScript method to execute.
  • The optional thisArg parameter is the value of this provided for the call to func. If not provided, will be replaced with the global object (globalThis).
  • Optional arg parameters will be passed to func in the order listed.

Example

Import Sys From "lib/lang/system.bas"

Dim b64 As String
b64 = Base64Encode("This is a test string")
Print b64
Print Base64Decode(b64)
Print
Print GetUUID
Print
Dim d As Object
d = Sys.Construct("Date")
Print "Raw:    "; d
Print "Year:   "; Sys.Call(d.getFullYear, d)
Print "Locale: "; Sys.Call(d.toLocaleString, d)

Function Base64Encode (value As String)
    Base64Encode = Sys.Call(globalThis.btoa, , value)
End Function

Function Base64Decode (value As String)
    Base64Decode = Sys.Call(globalThis.atob, , value)
End Function

Function GetUUID
    GetUUID = Sys.Call(globalThis.crypto.randomUUID, globalThis.crypto)
End Function

Output

Print ESC to exit...
VGhpcyBpcyBhIHRlc3Qgc3RyaW5n
This is a test string

b9f39c45-b4f4-46bc-b78c-483529431b74

Raw:    Sat Jul 11 2026 10:54:25 GMT-0500 (Central Daylight Time)
Year:   2026
Locale: 7/11/2026, 10:54:25 AM

See Also

Sys.Await
Sys.Construct
JavaScript - Function.prototype.apply()

Clone this wiki locally