API変更

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5689 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-01-04 03:56:08 +00:00
parent a2dd650e44
commit 12fdfcf9f7
2 changed files with 12 additions and 10 deletions

View File

@ -5,8 +5,8 @@
// window specific history
window['piro.sakura.ne.jp'].operationHistory.addEntry(
'MyAddonFeature',
{ undo : function() { ... },
redo : function() { ... } },
{ onUndo : function() { ... },
onRedo : function() { ... } },
window
);
window['piro.sakura.ne.jp'].operationHistory.undo('MyAddonFeature', window);
@ -32,12 +32,12 @@
// to reduce memory leak. For example...
var id = window['piro.sakura.ne.jp'].operationHistory.getWindowId(targetWindow);
window['piro.sakura.ne.jp'].operationHistory.addEntry({
undo : function() {
onUndo : function() {
// "this" in undo/redo functions refers the operationHistory service itself.
var w = this.getWindowById(id);
var w = window['piro.sakura.ne.jp'].operationHistory.getWindowById(id);
w.MyAddonService.undoSomething();
},
redo : ...
onRedo : ...
});
lisence: The MIT License, Copyright (c) 2009 SHIMODA "Piro" Hiroshi
@ -46,7 +46,7 @@
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/operationHistory.js
*/
(function() {
const currentRevision = 1;
const currentRevision = 2;
if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {};
@ -102,7 +102,7 @@
this._doingUndo = true;
var data = history.entries[history.index--];
try {
data.undo.call(this);
(data.onUndo || data.onundo)();
}
catch(e) {
error = e;
@ -126,7 +126,7 @@
this._doingUndo = true;
var data = history.entries[history.index++];
try {
data.redo.call(this);
(data.onRedo || data.onredo)(this);
}
catch(e) {
error = e;

View File

@ -38,12 +38,14 @@ TreeStyleTabBrowserTabpanelDNDObserver.prototype = {
sv.currentTabbarPosition = position;
window['piro.sakura.ne.jp'].operationHistory.addEntry(
'TabbarDNDOperations',
{ undo : function() { sv.currentTabbarPosition = current; },
redo : function() { sv.currentTabbarPosition = position; } },
{ onUndo : function() { TreeStyleTabService.currentTabbarPosition = current; },
onRedo : function() { TreeStyleTabService.currentTabbarPosition = position; } },
window
);
}
sv = null;
aEvent.stopPropagation();
},