Skip to content

Commit

Permalink
Update example code to match README (#75)
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Koops <jonkoops@gmail.com>
  • Loading branch information
jonkoops authored Jul 12, 2024
1 parent 363837c commit bbd25d1
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import whyIsNodeRunning from './index.js'
import net from 'node:net'
import whyIsNodeRunning from 'why-is-node-running' // should be your first import
import { createServer } from 'node:net'

function createServer () {
var server = net.createServer()
setInterval(function () {}, 1000)
function startServer () {
const server = createServer()
setInterval(() => {}, 1000)
server.listen(0)
}

createServer()
createServer()
startServer()
startServer()

setTimeout(function () {
whyIsNodeRunning()
}, 100)
// logs out active handles that are keeping node running
setImmediate(() => whyIsNodeRunning())

0 comments on commit bbd25d1

Please sign in to comment.