synced-set
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

synced-set

Synchronize a Set collection of objects across a wire.

npm i synced-set pnpm add synced-set yarn add synced-set

API

# SyncedSet

# add(object, fromRemote)

    # object
    # fromRemote  =  false

      boolean

    add(object, fromRemote)  =>

# clear()

    clear()  =>

      void
# delete(object)

    # object

    delete(object)  =>

      boolean
# deleteById(id)

    # id

      T [keyof T]

    deleteById(id)  =>

      void
# emit(eventName, args)
# forEach(callback, thisArg)

    # callback(value, value2, set)

      # value
      # value2
      # set

        Set<T>

      callback(value, value2, set)  =>

        void

# thisArg

    any

forEach(callback, thisArg)  =>

    void
# has(object)

    # object

    has(object)  =>

      boolean
# off(eventName, callback)
# on(eventName, callback, options)

    # eventName
    # callback
    # options

      EventEmitterOptions

    on<K>(eventName, callback, options)  =>

      Off
# once(eventName, callback)
# receive(payload)
# send()

    send()  =>

      void
# update(object)

    # object

    update(object)  =>

      void
# SyncedSetEvents

    # add

      # (item)

        # item

        (item)  =>

          void

# delete

    # (item)

      # item

      (item)  =>

        void

# update

    # (item, key)

      # item
      # key

        keyof T

      (item, key)  =>

        void

# SyncedSetOptions

    # id

      keyof T

    # pick

      keyof T []

    # equal(prev, next)

      # prev
      # next

      equal(prev, next)  =>

        boolean

# reducer(object)

    # object

    reducer(object)  =>

# send(payload, cb)

send(payload, cb)  =>

    void
# SyncedSetOptionsOptionalId

    # id

      keyof T

    # pick

      keyof T []

    # equal(prev, next)

      # prev
      # next

      equal(prev, next)  =>

        boolean

# reducer(object)

    # object

    reducer(object)  =>

# send(payload, cb)

send(payload, cb)  =>

    void
# SyncedSetPayload

    # added

      Set<T>

    # deleted

      Set<T [keyof T]>

    # updated

      Set<T>

# Id

    keyof T

Credits

Contributing

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2023 stagas

Readme

Keywords

none

Package Sidebar

Install

npm i synced-set

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

145 kB

Total Files

18

Last publish

Collaborators

  • stagas