Skip to content

Instantly share code, notes, and snippets.

@aaronc
Last active August 29, 2015 14:12
Show Gist options
  • Save aaronc/3318c76b3a79d8cd443e to your computer and use it in GitHub Desktop.
Save aaronc/3318c76b3a79d8cd443e to your computer and use it in GitHub Desktop.
Latest observable collections protocols
(defprotocol IObservableCollection
"Defines the minimum protocol required for an observable collection
to be bound to an items-view."
(-subscribe [coll key f]
"Where f is a functional taking 3 arguments:
the key, the collection, a sequence of changes in the form of:
[[key1 new-value1]
[key2 new-value2]
[key3] ;; missing new value indicates the element was removed
]
When the subscription is first initiated the collection will call f
some number of times passing the existing data in the collection.
If a collection would like, it may add additional information to the change
set using metadata.")
(-unsubscribe [coll key])
(-entity-cursor [coll entity-key]))
(defprotocol IEntityCursor
(-entity-key [this]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment