Skip to content

StartupSnapshot

[<Interface>]
type StartupSnapshot =
    static member Create (addSerializeCallback: Action<StartupSnapshotCallbackFn,obj option>, addDeserializeCallback: Action<StartupSnapshotCallbackFn,obj option>, setDeserializeMainFunction: Action<StartupSnapshotCallbackFn,obj option>, isBuildingSnapshot: unit -> bool) : StartupSnapshot
    abstract member addDeserializeCallback (callback: StartupSnapshotCallbackFn, ?data: obj) : unit
    abstract member addSerializeCallback (callback: StartupSnapshotCallbackFn, ?data: obj) : unit
    abstract member isBuildingSnapshot () : bool
    abstract member setDeserializeMainFunction (callback: StartupSnapshotCallbackFn, ?data: obj) : unit
AssemblyXantham.Fable.Node
Attributes[<Interface>]

Methods

static member Create (addSerializeCallback: Action<StartupSnapshotCallbackFn,obj option>, addDeserializeCallback: Action<StartupSnapshotCallbackFn,obj option>, setDeserializeMainFunction: Action<StartupSnapshotCallbackFn,obj option>, isBuildingSnapshot: unit -> bool) : StartupSnapshot
abstract member addDeserializeCallback (callback: StartupSnapshotCallbackFn, ?data: obj) : unit

Add a callback that will be called when the Node.js instance is deserialized from a snapshot. The callback and the data (if provided) will be serialized into the snapshot, they can be used to re-initialize the state of the application or to re-acquire resources that the application needs when the application is restarted from the snapshot.

@since v18.6.0, v16.17.0

abstract member addSerializeCallback (callback: StartupSnapshotCallbackFn, ?data: obj) : unit

Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit. This can be used to release resources that should not or cannot be serialized or to convert user data into a form more suitable for serialization.

@since v18.6.0, v16.17.0

abstract member isBuildingSnapshot () : bool

Returns true if the Node.js instance is run to build a snapshot.

@since v18.6.0, v16.17.0

abstract member setDeserializeMainFunction (callback: StartupSnapshotCallbackFn, ?data: obj) : unit

This sets the entry point of the Node.js application when it is deserialized from a snapshot. This can be called only once in the snapshot building script. If called, the deserialized application no longer needs an additional entry point script to start up and will simply invoke the callback along with the deserialized data (if provided), otherwise an entry point script still needs to be provided to the deserialized application.

@since v18.6.0, v16.17.0