Skip to content

Commit

Permalink
Fix SDK spec
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Dec 6, 2024
1 parent 48a8ff5 commit abd96a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ Data is a JavaScript object or JSON string that will be sent to the browser to u

##### Options

* `onlyIfMissing` (boolean) If `true`, the SDK ***should*** send the signal only if the data is not already in the signals. If not provided, the Datastar client side ***will*** default to `false`, which will cause the data to be merged into the signals.
* `onlyIfMissing` (boolean) Whether to merge the signal only if it does not already exist. If not provided, the Datastar client side ***will*** default to `false`, which will cause the data to be merged into the signals.

#### Logic
When called the function ***must*** call `ServerSentEventGenerator.send` with the `datastar-merge-signals` event type.

1. If `onlyIfMissing` is provided, the function ***must*** include the onlyIfMissing in the event data in the format `onlyIfMissing ONLY_IF_MISSING\n`, ***unless*** the value is the default of `false`. `ONLY_IF_MISSING` should be `true` or `false` (string), depending on the value of the `onlyIfMissing` option.
1. If `onlyIfMissing` is provided, the function ***must*** include it in the event data in the format `onlyIfMissing ONLY_IF_MISSING\n`, ***unless*** the value is the default of `false`. `ONLY_IF_MISSING` should be `true` or `false` (string), depending on the value of the `onlyIfMissing` option.
2. The function ***must*** include the signals in the event data, with each line prefixed with `signals `. This ***should*** be output after all other event data.

### `ServerSentEventGenerator.RemoveSignals`
Expand Down

0 comments on commit abd96a9

Please sign in to comment.