W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2011

[whatwg] Fixing undo on the Web - UndoManager and Transaction

From: Ryosuke Niwa <rniwa@webkit.org>
Date: Mon, 12 Sep 2011 18:06:52 -0700
Message-ID: <CABNRm60NR7b_9byo-5fNirETTrEYLeNkS9ySdsQxGudQom_Lzw@mail.gmail.com>
On Mon, Sep 12, 2011 at 5:19 PM, Jonas Sicking <jonas at sicking.cc> wrote:

> Could you please supply an example where the apply/reapply split leads
> to cleaner or otherwise better code than using a boolean argument?
>

apply: function() {
  // modify dom
  // send data back to server
},
unapply: function() {
  // ask server what I should do for undo
  // modify dom
},
reapply: function() {
  // ask sever what I should do for redo
  // modify dom
}

I can't give you a code from existing apps because such apps do not use
undoManager API.

Having slightly different signatures for the apply function on both
> transaction feels like a much smaller problem. Either we can rename
> 'apply' on automatic transactions, or we can give it a boolean
> argument too which is passed 'false'. It's easy enough to ignore
> arguments in JS, simply don't put them in your function signature.
>

I'm fine with adding a boolean argument if we're splitting the interface for
automatic and manual transactions because then we don't need to have boolean
argument in automatic transaction's apply.

- Ryosuke
Received on Monday, 12 September 2011 18:06:52 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:36 UTC