Skip to content

增加 silence 方式 #12

Closed
Closed
@hustcc

Description

@hustcc

[中级任务]

参考 batch 的方式,batch 是批量处理多个数据 API,只抛出一次 changes;silence 是处理数据后不抛出任何的 changes,两者都是对性能进行优化。

batch

Batch several graph changes into one. Make several changes, but dispatch only one ChangedEvent at the end of batch:

graph.batch(() => {
  graph.addNodes([]);
  graph.addEdges([]);
});

silence

DO NOT dispatch any changes.

graph.silence(() => {
  graph.addNodes([]);
  graph.addEdges([]);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions