Skip to content

Commit

Permalink
fix: register should not return promise
Browse files Browse the repository at this point in the history
  • Loading branch information
GrinZero committed Oct 23, 2024
1 parent b6d568a commit 4d1280b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion apps/koa/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const run = () => {
const Router = require('koa-router')
const { createFetch } = require('ofetch')

register({
const unregister = register({
autoOpenDevtool: true
})

Expand All @@ -31,6 +31,11 @@ const run = () => {
ctx.body = res
})

router.get('/unregister', async (ctx) => {
unregister()
ctx.body = 'Unregistered'
})

router.get('/post', async (ctx) => {
const res = await axios.post('https://jsonplaceholder.typicode.com/posts', {
title: 'foo',
Expand Down
2 changes: 1 addition & 1 deletion packages/network-debugger/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PORT, SERVER_PORT } from '../common'

import { RegisterOptions } from '../common'

export async function register(props?: RegisterOptions) {
export function register(props?: RegisterOptions) {
const { port = PORT, serverPort = SERVER_PORT, autoOpenDevtool = true } = props || {}
const mainProcess = new MainProcess({
port,
Expand Down

0 comments on commit 4d1280b

Please sign in to comment.