Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add addStatusHandler/removeStatusHandler to hot API #2565

Merged
merged 2 commits into from Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/turbopack-ecmascript/js/src/runtime.js
Expand Up @@ -891,6 +891,10 @@
// implement, but the Next.js React Refresh runtime uses this to decide
// whether to schedule an update.
status: () => "idle",

// NOTE(alexkirsz) Since we always return "idle" for now, these are no-ops.
addStatusHandler: (_handler) => {},
removeStatusHandler: (_handler) => {},
};

return { hot, hotState };
Expand Down
8 changes: 6 additions & 2 deletions crates/turbopack-ecmascript/js/types/hot.d.ts
Expand Up @@ -4,6 +4,8 @@ export const enum HotUpdateStatus {
idle = "idle",
}

export type HotUpdateStatusHandler = (status: HotUpdateStatus) => void;

export interface HotData {
prevExports?: Exports;
}
Expand Down Expand Up @@ -37,8 +39,6 @@ export interface Hot {
active: boolean;
data: HotData;

status: () => keyof typeof HotUpdateStatus;

accept: AcceptFunction;

decline: (module?: string | string[]) => void;
Expand All @@ -50,4 +50,8 @@ export interface Hot {
removeDisposeHandler: (callback: (data: object) => void) => void;

invalidate: () => void;

status: () => keyof typeof HotUpdateStatus;
addStatusHandler: (handler: HotUpdateStatusHandler) => void;
removeStatusHandler: (handler: HotUpdateStatusHandler) => void;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.