ds300 / derivablejs

Functional Reactive State for JavaScript and TypeScript
Apache License 2.0
515 stars 23 forks source link

add `transaction` function #4

Closed ds300 closed 9 years ago

ds300 commented 9 years ago

Using havelock, I end up writing a lot of callbacks that look like:

function () {
  transact(function () {
    // do stuffs
  });
}

I could get rid of that extra nesting level by having a transaction function which takes a function f and returns a function which calls f in the context of a transaction.