v8.startupSnapshot.addSerializeCallback(callback[, data])
-
callback
<Function> 在序列化之前调用的回调。¥
callback
<Function> Callback to be invoked before serialization. -
data
<any> 调用时将传给callback
的可选数据。¥
data
<any> Optional data that will be passed to thecallback
when it gets called.
添加一个回调,当 Node.js 实例即将序列化为快照并退出时将调用该回调。这可以用来释放不应该或者不能序列化的资源或者将用户数据转换成更适合序列化的形式。
¥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.
回调按照添加顺序运行。
¥Callbacks are run in the order in which they are added.