Граф коммитов

7 Коммитов

Автор SHA1 Сообщение Дата
Sean Doyle 909d41cc2f Incorporate checkables into `storageFilter:` 2024-02-01 15:54:54 -05:00
Sean Doyle 9d20e1f2fc
Update README.md
Co-authored-by: Ned Schwartz <ned@theinterned.net>
2024-01-24 14:57:08 -05:00
Sean Doyle 88fa8135e4 Support `scope:` and `fields:` options
By default, calls to `persistResumableFields()` will query the
`document` for elements with the (default or provided) `selector:`.

This commit adds support for specifying a `fields:` option, collecting
`NodeList` or `Node[]`, to provide the function with a set of `<input>`
or `<textarea>` elements to persist. Providing `fields:` would make
`selector:` redundant, and vice-versa.

```js
const myFields = document.querySelector("[data-persisted-field]")

// ...

// pass the `NodeList` directly
persistResumableFields(getPageID(), { fields: myFields })
// pass an array of `Node` instances
persistResumableFields(getPageID(), { fields: Array.from(myFields) })
```

Similarly, calls to `persistResumableFields()` will query the _document_
for elements with the (default or provided) `selector:` by default.

This commit adds support for specifying a `scope:` option to declare a
`ParentNode` instance other than the `document`.

```js
persistResumableFields(getPageID(), {
  scope: document.getElementById("my-scope"),
  selector: ".descendants-of-my-scope",
})
```
2024-01-24 14:16:50 -05:00
Sean Doyle 4077389a6a Add function option documentation to `README.md`
Adds sections for both `restoreResumableFields` and
`persistResumableFields` to highlight the possible options.
2024-01-20 16:10:27 -05:00
Nick Rolfe 10553dc7a6 Fix typos in readme 2021-10-05 10:56:43 +00:00
David Graham 7c204e7497
Replace Babel + Flow with TypeScript
Uses our current toolchain to build the project and removes
`for…of` iterator transformation in the module output.

No behavior or API changes here.
2020-04-10 10:46:15 -06:00
Kristján Oddsson f56148e134
add README 2019-02-06 18:13:36 +00:00