bruth / synapse

Hooks to support data binding between virtually any object.
http://bruth.github.com/synapse/docs/
BSD 2-Clause "Simplified" License
150 stars 6 forks source link

vanilla object binding #7

Closed pgherveou closed 12 years ago

pgherveou commented 12 years ago

Hello first thks for this project, it really clean all my binding boiler plate code

It works fine for my Backbone models but I can't make it work for vanilla object like date for example I use date.js that inject all the date methods below, and then try to bind the year, month and day of the textfield

    Synapse($ '#event-date').sync date,
      convert: (date) -> date.toString("D, d M yyyy")
      handler: (val)  -> 
        d = Date.parse val 
        date.set {year: d.year, month: d.month, day:d.day} 
bruth commented 12 years ago

Currently, Synapse.sync does not take any options for configuration. Since the directionality of them is ambiguous ('#event-date' -> date or date -> '#event-date'). Break them up into two bind using Synapse.observe or Synapse.notify