@danielkalen/simplybind
Version:
Magically simple, framework-less one-way/two-way data binding for frontend/backend in ~5kb.
56 lines (29 loc) • 1.54 kB
text/coffeescript
defineProperty = Object.defineProperty
getDescriptor = Object.getOwnPropertyDescriptor
# simplyimport:if BUNDLE_TARGET = 'browser'
import './changeEvent'
import './requiresDomDescriptorFix'
import './windowPropsToIgnore'
# simplyimport:end
setValueNoop = (v, publisher)-> @updateAllSubs(publisher or @)
genID = ()-> ''+(++currentID)
genObj = ()-> Object.create(null)
genProxiedInterface = (isSub, completeCallback)-> (subject, customOptions, saveOptions)->
SimplyBind(subject, customOptions, saveOptions, isSub, completeCallback)
genSelfUpdater = (binding, fetchValue)->
binding.selfUpdater or
binding.selfUpdater = new Binding ()->
if fetchValue then binding.setValue(binding.fetchDirectValue(), binding, true) else binding.updateAllSubs(binding)
, 'Func', {}
# ==== Checks =================================================================================
import './checks'
# ==== Descriptor Modification =================================================================================
import './descriptor-mod'
# ==== Object cloning =================================================================================
import './cloning'
# ==== Binding Cache =================================================================================
import './cache'
# ==== Placeholders =================================================================================
import './placeholders'
# ==== Errors + Warnings =================================================================================
import './errors'