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

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

Open
acoreyj opened this issue Feb 21, 2025 · 1 comment
Open

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

acoreyj opened this issue Feb 21, 2025 · 1 comment
Assignees

Comments

@acoreyj
Copy link

acoreyj commented Feb 21, 2025

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}`,

@jamesgpearce
Copy link
Contributor

Ouch - my bad. Thanks.

@jamesgpearce jamesgpearce self-assigned this Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants