Skip to content

December 17, 2024

Compare
Choose a tag to compare
@theguild-bot theguild-bot released this 17 Dec 13:51
· 65 commits to master since this release
dd8f5d1

@whatwg-node/[email protected]

Patch Changes

  • #1899
    a84e84a
    Thanks @ardatan! - - New onDispose hook which is alias of
    Symbol.asyncDispose for Explicit Resource Management

    • Registration of the server adapter's disposal to the global process termination listener is now
      opt-in and configurable.
    const plugin: ServerAdapterPlugin = {
      onDispose() {
        console.log('Server adapter is disposed')
      }
    }
    
    const serverAdapter = createServerAdapter(() => new Response('Hello world!'), {
      plugins: [plugin],
      // Register the server adapter's disposal to the global process termination listener
      // Then the server adapter will be disposed when the process exit signals only in Node.js!
      disposeOnProcessTerminate: true
    })
    
    await serverAdapter.dispose()
    // Prints 'Server adapter is disposed'