简体   繁体   中英

How can I use the undo function in dojox?

We are using Dojo toolkit on our whole project. Now I want to add undo function. For example: When you press ctrl + z , the system goes one step back. I found undo function from Dojox. But I just can't successfully use it, because the documentary is so unclear.

Here is the usage that I found in the Dojox documentary:

var foo = new Undo(options);
foo.undo(); 

But options is undefined. I don't know what should I write as options . How can i use the undo from Dojox? What is the detailed usage?

according to the source code... 1.16.3

the only accepted part of options are the keys to bind ctrl-z and ctrl-y

if you don't need keybinding use empty options:

var foo = new Undo({}); // empty options
foo.undo(); 

or pass options.keys require singleton keys or use existing instance

require(["dojo/keys"], function(keys) {
    var foo = new Undo({keys: keys}); // pass options.keys = obtained singleton keys
    foo.undo(); 
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM