Skip to content

IdAddedOrRemoved being -1 or 1 makes it always truthy #216

@acoreyj

Description

@acoreyj

Because of this examples like the one below will always say 'Added'. Either addedOrRemoved should be 1 or 0, a boolean, or the example needs to be addedOrRemoved > 0

import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';

export class MyDurableObject extends [WsServerDurableObject](https://tinybase.org/api/synchronizer-ws-server-durable-object/classes/creation/wsserverdurableobject/) {
  [onPathId](https://tinybase.org/api/synchronizer-ws-server-durable-object/classes/creation/wsserverdurableobject/methods/event/onpathid/)(pathId, addedOrRemoved) {
    console.info(
      (addedOrRemoved ? 'Added' : 'Removed') + ` path ${pathId}`,
    );
  }
}

* (addedOrRemoved ? 'Added' : 'Removed') + ` path ${pathId}`,

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions