rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
35 lines • 1.72 kB
TypeScript
import { type IManagedObject, type IOnFreeListener, type IPointer } from "../../lifecycle/manged-resources.js";
import type { IDebugProtectedViewFactory } from "../../debug/i-debug-protected-view-factory.js";
import type { IEmscriptenWrapper } from "../emscripten/i-emscripten-wrapper.js";
import type { IInteropBindings } from "../emscripten/i-interop-bindings.js";
/**
* @public
* Defines the cleanup behavior of {@link SharedObjectCleanup}
*/
export declare enum ESharedObjectOwnerKind {
NotOwning = 1,
SharedMemoryOwner = 2,
Freeable = 3
}
/**
* @public
*
* Provides reasonable defaults for cleaning up a handle to a `JsInterop::ASharedMemoryObject`.
*/
export declare class SharedObjectCleanup implements IOnFreeListener {
protected readonly ownershipKind: ESharedObjectOwnerKind;
static Options: {
new (debugName: string, protectedView: IDebugProtectedViewFactory | null, ownershipKind: ESharedObjectOwnerKind): {
readonly debugName: string;
readonly protectedView: IDebugProtectedViewFactory | null;
readonly ownershipKind: ESharedObjectOwnerKind;
};
};
readonly wrapper: IEmscriptenWrapper<IInteropBindings>;
readonly ptr: number;
static createWithCleanup(sharedObject: IManagedObject & IPointer, options: InstanceType<typeof SharedObjectCleanup.Options>): SharedObjectCleanup;
static registerCleanup(sharedObject: IManagedObject & IPointer, cleanup: SharedObjectCleanup, options: InstanceType<typeof SharedObjectCleanup.Options>): void;
constructor(sharedObject: IManagedObject & IPointer, ownershipKind: ESharedObjectOwnerKind);
onFree(): void;
}
//# sourceMappingURL=shared-object-cleanup.d.ts.map