v8.startupSnapshot.addDeserializeCallback(callback[, data])


  • callback <Function> 快照反序列化后要调用的回调函数。
  • data <any> 可选数据,在调用 callback 时会传递给它。

添加一个回调,当 Node.js 实例从快照反序列化时将会调用该回调。callbackdata(如果提供)将会被序列化到快照中,它们可以用于重新初始化应用的状态,或者在应用从快照重新启动时重新获取应用所需的资源。

【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.】

回调按照添加顺序运行。

【Callbacks are run in the order in which they are added.】