Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWangJustToDo committed Nov 20, 2024
1 parent 42f1f50 commit ad38e1e
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 6 deletions.
8 changes: 7 additions & 1 deletion chrome/public/bundle/detector.js

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

8 changes: 7 additions & 1 deletion chrome/public/bundle/hook.js

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

8 changes: 7 additions & 1 deletion chrome/public/bundle/panel.js

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

8 changes: 7 additions & 1 deletion chrome/public/bundle/proxy.js

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

8 changes: 7 additions & 1 deletion chrome/public/bundle/service-worker.js

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

12 changes: 11 additions & 1 deletion packages/core/src/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export const throttle = <T extends Function>(callback: T, time?: number): T => {
}) as unknown as T;
};

const map = new Map();

export class DevToolCore {
_dispatch: Set<DevToolRenderDispatch> = new Set();

Expand Down Expand Up @@ -404,7 +406,7 @@ export class DevToolCore {
if (!this.hasEnable) return;

this._notify({ type: DevToolMessageEnum.trigger, data: this._trigger });
}, 100);
}, 16);

notifyRun = debounce(() => {
if (!this.hasEnable) return;
Expand Down Expand Up @@ -480,6 +482,14 @@ export class DevToolCore {
if (!this.hasEnable) return;

if (this._dispatch.has(dispatch)) {
const now = Date.now();

const last = map.get(dispatch);

if (last && now - last < 200) return;

map.set(dispatch, now);

const tree = this.getTree(dispatch);

this._notify({ type: DevToolMessageEnum.ready, data: tree });
Expand Down

0 comments on commit ad38e1e

Please sign in to comment.