ngx-ui-scroll icon indicating copy to clipboard operation
ngx-ui-scroll copied to clipboard

Updater optimization

Open dhilt opened this issue 5 years ago • 0 comments

Currently Workflow.fix({ updater }) runs through all the items in the Buffer. Could the procedure be optimized? There is a suggestion to convert updater into predicate function or provide breaking callback:

  // predicate
  this.datasource.adapter.fix({
    updater: ({ data }: { data: MyItem }) => {
      if (this.needToUpdate(data)) {
        this.updateItem(data);
        return true;
      }
    }
  });

  // callback
  this.datasource.adapter.fix({
    updater: ({ data }: { data: MyItem }, callback: Function) => {
      if (this.needToUpdate(data)) {
        this.updateItem(data);
        callback();
      }
    }
  });

Source: issue 121

dhilt avatar Jan 30 '20 17:01 dhilt