Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.ns.d.ts>Deno.ForeignFunction

A modern runtime for JavaScript and TypeScript.
Latest
interface Deno.ForeignFunction
import { type Deno } from "https://deno.land/x/deno@v2.0.4/cli/tsc/dts/lib.deno.ns.d.ts";
const { ForeignFunction } = Deno;

The interface for a foreign function as defined by its parameter and result types.

Type Parameters

optional
Parameters extends readonly NativeType[] = readonly NativeType[]
optional
Result extends NativeResultType = NativeResultType
optional
NonBlocking extends boolean = boolean

Properties

optional
name: string

Name of the symbol.

Defaults to the key name in symbols object.

parameters: Parameters

The parameters of the foreign function.

result: Result

The result (return value) of the foreign function.

optional
nonblocking: NonBlocking

When true, function calls will run on a dedicated blocking thread and will return a Promise resolving to the result.

optional
optional: boolean = false

When true, dlopen will not fail if the symbol is not found. Instead, the symbol will be set to null.