Commit 0c50834d authored by antoor's avatar antoor

Rewriting class binding method

重写类绑定方法
parent 78755518
......@@ -93,13 +93,13 @@ class ASP {
{
text: '添加配置',
icon: 'fa fa-plus-circle',
action: this::this.addConf
action: this.addConf.bind(this)
}, {
divider: true
}, {
text: '删除配置',
icon: 'fa fa-remove',
action: this::this.delConf
action: this.delConf.bind(this)
}
], event);
});
......@@ -456,7 +456,7 @@ class ASP {
// 禁用SQL编辑框
disableEditor() {
['exec', 'clear'].map(
this.manager.query.toolbar::this.manager.query.toolbar.disableItem
this.manager.query.toolbar.disableItem.bind(this.manager.query.toolbar)
);
this.manager.query.editor.setReadOnly(true);
}
......@@ -464,7 +464,7 @@ class ASP {
// 启用SQL编辑框
enableEditor() {
['exec', 'clear'].map(
this.manager.query.toolbar::this.manager.query.toolbar.enableItem
this.manager.query.toolbar.enableItem.bind(this.manager.query.toolbar)
);
this.manager.query.editor.setReadOnly(false);
}
......
......@@ -89,13 +89,13 @@ class ASP {
{
text: '添加配置',
icon: 'fa fa-plus-circle',
action: this::this.addConf
action: this.addConf.bind(this)
}, {
divider: true
}, {
text: '删除配置',
icon: 'fa fa-remove',
action: this::this.delConf
action: this.delConf.bind(this)
}
], event);
});
......@@ -455,7 +455,7 @@ class ASP {
// 禁用SQL编辑框
disableEditor() {
['exec', 'clear'].map(
this.manager.query.toolbar::this.manager.query.toolbar.disableItem
this.manager.query.toolbar.disableItem.bind(this.manager.query.toolbar)
);
this.manager.query.editor.setReadOnly(true);
}
......@@ -463,7 +463,7 @@ class ASP {
// 启用SQL编辑框
enableEditor() {
['exec', 'clear'].map(
this.manager.query.toolbar::this.manager.query.toolbar.enableItem
this.manager.query.toolbar.enableItem.bind(this.manager.query.toolbar)
);
this.manager.query.editor.setReadOnly(false);
}
......
......@@ -84,13 +84,13 @@ class PHP {
{
text: LANG['list']['menu']['add'],
icon: 'fa fa-plus-circle',
action: this::this.addConf
action: this.addConf.bind(this)
}, {
divider: true
}, {
text: LANG['list']['menu']['del'],
icon: 'fa fa-remove',
action: this::this.delConf
action: this.delConf.bind(this)
}
], event);
});
......@@ -481,7 +481,7 @@ class PHP {
// 禁用SQL编辑框
disableEditor() {
['exec', 'clear'].map(
this.manager.query.toolbar::this.manager.query.toolbar.disableItem
this.manager.query.toolbar.disableItem.bind(this.manager.query.toolbar)
);
this.manager.query.editor.setReadOnly(true);
}
......@@ -489,7 +489,7 @@ class PHP {
// 启用SQL编辑框
enableEditor() {
['exec', 'clear'].map(
this.manager.query.toolbar::this.manager.query.toolbar.enableItem
this.manager.query.toolbar.enableItem.bind(this.manager.query.toolbar)
);
this.manager.query.editor.setReadOnly(false);
}
......
......@@ -837,7 +837,7 @@ class FileManager {
editor.session.setValue(ret);
// 定时刷新
const inter = setInterval(editor::editor.resize, 200);
const inter = setInterval(editor.resize.bind(editor), 200);
win.attachEvent('onClose', () => {
clearInterval(inter);
return true;
......
//
//
// 插件中心
//
//
const LANG = antSword['language']['plugin'];
const LANG_T = antSword['language']['toastr'];
......@@ -8,7 +8,7 @@ const LANG_T = antSword['language']['toastr'];
class Plugin {
constructor() {
antSword['menubar'].reg('plugin', this::this.open);
antSword['menubar'].reg('plugin', this.open.bind(this));
this.homepage = 'http://u.uyu.us/';
}
......@@ -24,9 +24,9 @@ class Plugin {
null, null, true, true
);
const cell = tabbar.tabs('tab_plugin');
//
//
// @创建浏览器工具栏:后退、前进、刷新、主页、停止
//
//
const toolbar = cell.attachToolbar();
toolbar.loadStruct([
{ id: 'back', type: 'button', text: '', icon: 'chevron-left' },
......@@ -39,8 +39,8 @@ class Plugin {
// 开始加载web
cell.progressOn();
const frame = cell.attachURI(this.homepage);
frame.addEventListener('did-start-loading', cell::cell.progressOn);
frame.addEventListener('did-finish-load', cell::cell.progressOff);
frame.addEventListener('did-start-loading', cell.progressOn.bind(cell));
frame.addEventListener('did-finish-load', cell.progressOff.bind(cell));
frame.addEventListener('did-fail-load', (err) => {
cell.progressOff();
// cell.close();
......@@ -74,4 +74,4 @@ class Plugin {
}
export default Plugin;
\ No newline at end of file
export default Plugin;
......@@ -10,7 +10,7 @@ import AProxy from './aproxy'
class Settings {
constructor() {
antSword['menubar'].reg('settings', this::this.open);
antSword['menubar'].reg('settings', this.open.bind(this));
['about', 'update', 'language', 'aproxy'].map((_) => {
antSword['menubar'].reg(`settings-${_}`, this.setActive.bind(this, _));
});
......
//
// 右侧目录管理模块
//
/**
* 右侧目录管理模块
*/
'use strict';
......@@ -95,7 +95,7 @@ class Category {
sidebar.callEvent('onSelect', ['default']);
// 3. 删除侧边栏
sidebar.items(category).remove();
setTimeout(this::this.updateTitle, 100);
setTimeout(this.updateTitle.bind(this), 100);
}else{
return toastr.error(LANG['category']['del']['error'](category, ret.toString()), LANG_T['error']);
}
......@@ -139,4 +139,4 @@ class Category {
}
export default Category;
\ No newline at end of file
export default Category;
//
// Shell管理模块
//
/**
* Shell管理模块
*/
'use strict';
......@@ -37,7 +37,7 @@ class ShellManager {
this.win.attachViewportTo(cell.cell);
// 监听菜单栏消息
antSword['menubar'].reg('shell-add', this::this.addData);
antSword['menubar'].reg('shell-add', this.addData.bind(this));
this.loadData();
......
//
// 左侧shell数据管理模块
//
/**
* 左侧shell数据管理模块
*/
// import Db from '../../database/';
import Terminal from '../terminal/';
import Database from '../database/';
import FileManager from '../filemanager/';
......@@ -36,7 +35,7 @@ class List {
${LANG['list']['grid']['ctime']},
${LANG['list']['grid']['utime']}
`);
grid.setColTypes("ro,ro,ro,ro,ro");
grid.setColTypes("ro,ro,ro,ro,ro");
grid.setColSorting('str,str,str,str,str');
grid.setInitWidths("200,120,*,140,140");
grid.setColAlign("left,left,left,center,center");
......@@ -82,7 +81,7 @@ class List {
{ text: LANG['contextmenu']['plugin'], icon: 'fa fa-puzzle-piece', disabled: !id || ids.length !== 1 || true, subMenu: [] },
{ text: LANG['contextmenu']['pluginCenter'], icon: 'fa fa-cart-arrow-down', action: antSword['menubar'].run.bind(antSword['menubar'], 'plugin') },
{ divider: true },
{ text: LANG['contextmenu']['add'], icon: 'fa fa-plus-circle', action: manager::manager.addData },
{ text: LANG['contextmenu']['add'], icon: 'fa fa-plus-circle', action: manager.addData.bind(manager) },
{ text: LANG['contextmenu']['edit'], icon: 'fa fa-edit', disabled: !id || ids.length !== 1, action: () => {
manager.editData(id);
} },
......@@ -118,12 +117,12 @@ class List {
});
return ret;
})() },
{ text: LANG['contextmenu']['search'], icon: 'fa fa-search', action: manager::manager.searchData, disabled: true },
{ text: LANG['contextmenu']['search'], icon: 'fa fa-search', action: manager.searchData.bind(manager), disabled: true },
{ divider: true },
{ text: LANG['contextmenu']['clearCache'], icon: 'fa fa-trash-o', disabled: !id, action: () => {
manager.clearCache(id);
} },
{ text: LANG['contextmenu']['clearAllCache'], icon: 'fa fa-trash', action: manager::manager.clearAllCache }
{ text: LANG['contextmenu']['clearAllCache'], icon: 'fa fa-trash', action: manager.clearAllCache.bind(manager) }
], event);
return true;
......@@ -156,4 +155,4 @@ class List {
}
}
export default List;
\ No newline at end of file
export default List;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment