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

fix: message open duration should be ms #3545

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/overlay/src/browser/message.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ export class MessageService extends AbstractMessageService implements IMessageSe
private showTime = 0;

// 相同文案返回的间隔时间
// https://github.com/react-component/notification#notificationnoticeprops
protected static SAME_MESSAGE_DURATION = 30;
protected static SAME_MESSAGE_DURATION_MS = 3000;

// 参考 vscode message 组件消失的时间
// 单位为秒: https://github.com/react-component/notification#notificationnoticeprops
protected static DURATION: { [type: number]: number } = {
[MessageType.Info]: 15,
[MessageType.Warning]: 18,
Expand Down Expand Up @@ -51,7 +50,7 @@ export class MessageService extends AbstractMessageService implements IMessageSe
let message = rawMessage;
// 如果两秒内提示信息相同,则直接返回上一个提示
if (
Date.now() - this.showTime < MessageService.SAME_MESSAGE_DURATION &&
Date.now() - this.showTime < MessageService.SAME_MESSAGE_DURATION_MS &&
typeof message === 'string' &&
this.preMessage === message
) {
Expand Down
Loading