native
namespace nativeFunctions
definePlatform<Handler>(handlers: PlatformHandlers<Handler>): Handler
Selects the Platform handler for the host platform, so an addon branches on the platform in one place.
Returns
The host platform's handler.
getNativeModule<T>(...names: string[]): T
Resolves the first available native module matching any of the given names, checking both NativeModules and the TurboModuleRegistry.
Returns
The first matching native module.
getNativeResources(): NativeResourceCounts | undefined
Reads how many native resources the loader holds: installed hooks, mounted surfaces, cached hook return values and Java handles still referenced from JavaScript.
Returns
The counts, or undefined when the loader does not report them.
getRuntimeProperties(): any
Reads Hermes' runtime metadata, such as the bytecode version, GC, and build channel.
Returns
The runtime property map, or an empty object when Hermes internals are unavailable.
has(capability: NativeBridgeCapability): boolean
Checks whether the native bridge on this device provides a capability, so an addon can fall back when the other platform lacks it.
Returns
Whether the bridge provides it.
reload(): Promise<void>
Persists pending settings to storage, then reloads the native bundle.
supports(method: NativeBridgeMethod): boolean
Checks whether the loader on this device implements a bridge method, for methods newer than the capability that gates them.
Returns
Whether the loader implements it.
Classes
Thrown when a plugin uses a Capability its manifest does not declare, or declares one that is unknown or the native bridge lacks.
Thrown when native work is called through a plugin's scope after the scope was disposed, such as after the plugin stopped.
Thrown when the loader does not provide the native bridge, or the part of it a call needs.
Thrown when the host platform is not one the addon runs on, by its manifest or the handlers given to definePlatform.
Thrown when the native bridge API is older than the manifest's minNativeBridgeApi.
Types
Build and release metadata reported by the native client info module.
The native BundleUpdaterManager module surface for OTA updates and reloading the bundle.
The constant directory paths exposed by the native DCDFileManager.
How the native file manager encodes file contents: UTF-8 text or base64 for binary data.
The native DCDFileManager module surface for reading, writing, and inspecting files.
Hardware and OS details reported by the native device module.
What HermesInternal.getRuntimeProperties() reports; empty when the engine is not Hermes.
One Platform handler per platform an addon runs on.
A native method Discord exposes without documenting what its promise resolves to.
A key from objc.createAssociationKey that names one associated object.
Refers to an earlier step's result inside objc.batch, as a target or an argument.
One Objective-C call in objc.batch; a batch takes up to 64 steps.
The native bridge a plugin reaches through context.native, gated by the capabilities it declares.
A named permission to use one part of the native bridge, declared in an addon's manifest.
The shape of an error the native bridge or its plugin scope throws.
The stable code on an error the native bridge or its plugin scope throws.
A native bridge method by the path a plugin calls it through, such as objc.invoke.
A host platform the loader reports, ios or android.
Options for a synchronous Objective-C call.
A promise for native work; cancel drops it, and stopping the plugin cancels every pending one.
A handle to an Objective-C class, from objc.getClass.
Debugger support for plugins.
Facts about the device a debugger session needs.
One debugger evaluation, which the loader logs and keeps in its evaluation history.
One surface's changes in a batchAsync call, applied as properties, then size, then frame.
Mounts registered React Native components inside existing native views. Sync methods are iOS only.
A view's frame in its container, in points on iOS and dp on Android.
Options for mounting a Fabric surface.
A Fabric surface size, in points on iOS and dp on Android, between 0 and 32,768.
A mounted Fabric surface; the plugin scope unmounts it on dispose.
Calls C functions in images Discord already loaded. An unsigned plugin needs the user's consent to use it.
A non-variadic C function signature for ffi.call.
An FFI type: a scalar or pointer name, or a registered struct by name, such as { struct: 'CGRect' }.
A C type in an FFI signature; object, class and selector exist only on iOS.
An opaque reference to a native object. Only the bridge creates handles; plugins pass them back.
What an Objective-C hook handler receives for one call of the hooked method.
The handlers an Objective-C hook runs around each call; it needs at least one, unless cacheOnly is set.
Options for objc.hook.
Trims what a hook sends to JavaScript per call, to cut crossing cost on hot methods.
An installed Objective-C hook; the plugin scope removes it on dispose.
An argument to a Java call: a tagged value or a handle.
A key from java.createAssociationKey that names one associated value.
One independent operation in a Java batch or batchAsync.
The Android bridge to Java through reflection. Sync calls run on the JavaScript thread, so touch views only asynchronously.
A method resolved once by java.prepare, for calling many times without the lookup.
A Java class's shape, read by reflection with java.describe.
One field a Java class declares, from java.describe.
A handle to a Java object or class; the plugin scope releases it on dispose.
A Java object reference the bridge returns inside a result.
What a Java hook listener receives for one call of the hooked method.
Options for hooks.hook.
What a rewriteArguments listener returns to run the hooked method with other arguments, one per parameter.
The Android bridge for hooking Java methods. Needs native.java.hooks.
An installed Java hook; the plugin scope removes it on dispose.
One method a Java class declares, from java.describe.
A Java object implementing interfaces through a handler; remove its token to stop it answering.
What a proxy handler receives for one call of an interface method.
A Java object, as a handle or as a tagged handle value from a result.
A Java value tagged with its type, as the Java bridge returns and accepts it.
The iOS bridge to the Objective-C runtime, scoped to the plugin's capabilities.
A selector and method signature resolved once by objc.prepare, for calling many times without the lookup.
A retained handle to an Objective-C object.
Platform-wide helpers the loader publishes as globalThis.NativePlatform, not scoped to a plugin.
A handle to a native symbol's address, from ffi.symbol; ffi.call accepts only these.
Delivers Discord activity to plugins. Needs native.runtime.events.
A Discord activity a plugin can subscribe to; the client derives each from Flux actions, such as MESSAGE_CREATE.
A runtime event subscription; the plugin scope removes it on dispose.
A plain object of serializable values, such as a runtime event payload.
A registered C struct, such as CGRect, built by objc.struct or returned from a native call.
Where a native call runs: current is the calling thread; main blocks until the main thread runs it;
main-post queues a void method on main and logs its failure, and blocks like main otherwise.
A value a worklet can take from the JS runtime: a serializable value, a UI scope, which is shared as is, or a callback into the JS thread.
Runs plugin worklets on the UI runtime, where native views live, so hooks there act before the next frame.
A function a worklet calls on the UI runtime to hand serializable values to a listener on the JS thread, made with callback.
The bridge methods a plugin may call from the UI runtime, synchronously and on the main thread.
Limits and direction for a breadth-first findViews search; larger limits are clamped.
One view in an objc.snapshot result, which lists views in breadth-first order.
Limits for objc.snapshot; larger values are clamped and non-integers rejected.
What the addon manager passes to a plugin's start.
Variables
The resolved native client info module, exposing build and release metadata.
The resolved native bundle updater module, used to check for updates and reload the bundle.
The resolved native device module, exposing hardware and OS details.
NativePlatform: NativePlatformBridge | undefined
The loader's platform bridge, read from globalThis.NativePlatform at import; undefined when no loader injected it.