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

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

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

UNSTABLE: New API, yet to be vetted.

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
callback: boolean

When true, function calls can safely callback into JavaScript or trigger a garbage collection event.

Default is false.