Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Allow observable objects as alternative to 'cells' #6

Closed
m1sta opened this issue Aug 8, 2013 · 2 comments
Closed

Enhancement: Allow observable objects as alternative to 'cells' #6

m1sta opened this issue Aug 8, 2013 · 2 comments

Comments

@m1sta
Copy link

m1sta commented Aug 8, 2013

Using individual variables for elements in a reactive chain forces you to keep using .get() and .set(). Syntax would be cleaner if this could be avoided through the use of getter and setter functions on object properties. All variables linked to a template could be hosted within a single 'document' (ie. the graph of data used within a reactive view).

A simple function called 'reactive' which makes changes to any object observable could make for some very clean syntax like the following...

    reactive class task
       constructor: (description, priority, isDone) ->
           [@description, @priority, @isDone] = [description, priority, isDone]

    taskList = reactive array
       0: new task 'a','b','c'
       1: new task 'd','e','f'

I'm obviously using a simple helper function called 'array' because I've got unlove for brackets but it's just as nice when a standard array is being passed to the 'reactive' function.

@yang
Copy link
Collaborator

yang commented Aug 9, 2013

This makes a lot of sense. We'd love to add this into a release soon. Thanks!

@yang
Copy link
Collaborator

yang commented Aug 15, 2013

Digging into this now - the syntax will likely be a bit different, in that you need to define the property descriptors based on the values (post-constructor-time) or some field spec (at class definition time).

@yang yang closed this as completed in abfd89f Aug 19, 2013
yang added a commit to inferinc/reactive-coffee-web that referenced this issue Aug 19, 2013
yang added a commit to inferinc/reactive-coffee-web that referenced this issue Aug 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants