зеркало из https://github.com/mozilla/FlightDeck.git
converting add/fire/removeEvent to addListener/emit
This commit is contained in:
Родитель
1848a9b01d
Коммит
9f55f7e244
|
@ -121,7 +121,9 @@ module.exports = new Class({
|
|||
},
|
||||
|
||||
parseTestButtons: function() {
|
||||
if (!this.isAddonInstalled()) return;
|
||||
if (!this.isAddonInstalled()) {
|
||||
return;
|
||||
}
|
||||
ABH().send('isInstalled').then(function(response) {
|
||||
if (response.success) {
|
||||
dom.$$(string.substitute('.{try_in_browser_class} a', this.options))
|
||||
|
@ -251,11 +253,11 @@ module.exports = new Class({
|
|||
}
|
||||
if (responseText) {
|
||||
if (fd.item) {
|
||||
this.fireEvent('xpi_downloaded', hashtag);
|
||||
this.emit('xpi_downloaded', hashtag);
|
||||
}
|
||||
ABH().send("install", responseText).then(function(response) {
|
||||
if (response && response.success) {
|
||||
this.fireEvent('xpi_installed', '');
|
||||
this.emit('xpi_installed', '');
|
||||
} else {
|
||||
if (response) {
|
||||
log.debug('Unsuccessful response:', response);
|
||||
|
@ -298,7 +300,7 @@ module.exports = new Class({
|
|||
uninstallXPI: function() {
|
||||
ABH().send('uninstall').then(function(response){
|
||||
if (response.success) {
|
||||
this.fireEvent('xpi_uninstalled');
|
||||
this.emit('xpi_uninstalled');
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
@ -328,7 +330,9 @@ module.exports = new Class({
|
|||
alertIfOldHelper: function() {
|
||||
// run this only once per request
|
||||
var that = this;
|
||||
if (this.old_helper_checked) return;
|
||||
if (this.old_helper_checked) {
|
||||
return;
|
||||
}
|
||||
if (settings.addons_helper_version && ABH()) {
|
||||
if (!ABH().send({cmd: 'version'}).then) {
|
||||
that.warning.alert(
|
||||
|
|
|
@ -115,7 +115,7 @@ module.exports = new Class({
|
|||
remove();
|
||||
}
|
||||
}, options.duration || this.options.duration);
|
||||
item.addEvents({
|
||||
item.addListeners({
|
||||
mouseover: function() {
|
||||
over = true;
|
||||
},
|
||||
|
@ -129,7 +129,7 @@ module.exports = new Class({
|
|||
}
|
||||
item.inject(this.body);
|
||||
anim.start(to);
|
||||
return this.fireEvent('show', item, this.items.length);
|
||||
return this.emit('show', item, this.items.length);
|
||||
},
|
||||
|
||||
remove: function(item) {
|
||||
|
@ -138,7 +138,7 @@ module.exports = new Class({
|
|||
return this;
|
||||
}
|
||||
this.items.splice(index, 1);
|
||||
item.removeEvents();
|
||||
item.removeListeners();
|
||||
var to = {opacity: 0};
|
||||
to[this.align.y] = parseInt(item.getStyle(this.align.y), 10) - item.get('offsetHeight') - this.options.offset;
|
||||
|
||||
|
@ -186,7 +186,7 @@ module.exports = new Class({
|
|||
this.moveTo = anim.start.bind(anim);
|
||||
}
|
||||
var repos = this.reposition.bind(this);
|
||||
dom.window.addEvents({
|
||||
dom.window.addListeners({
|
||||
scroll: repos,
|
||||
resize: repos
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ var LOADING_CLASS = 'loading',
|
|||
fd;
|
||||
|
||||
var browser_test_item = function(el) {
|
||||
el.addEvent('click', function(e){
|
||||
el.addListener('click', function(e){
|
||||
e.stop();
|
||||
var hashtag = this.get('data-hashtag');
|
||||
var testThisXpi = function() {
|
||||
|
@ -47,7 +47,7 @@ var browser_test_item = function(el) {
|
|||
};
|
||||
|
||||
var browser_disable_item = function(el) {
|
||||
el.addEvent('click', function(e){
|
||||
el.addListener('click', function(e){
|
||||
if (e) {
|
||||
e.stop();
|
||||
}
|
||||
|
@ -60,9 +60,9 @@ var browser_disable_item = function(el) {
|
|||
response = JSON.parse(response);
|
||||
el.getParent('li.UI_Item').destroy();
|
||||
fd.message.alert(response.message_title, response.message);
|
||||
fd.fireEvent('deactivate_' + response.package_type);
|
||||
fd.emit('deactivate_' + response.package_type);
|
||||
if (dom.$('activate')) {
|
||||
dom.$('activate').addEvent('click', function(e2){
|
||||
dom.$('activate').addListener('click', function(e2){
|
||||
e2.stop();
|
||||
new Request({
|
||||
url: el.get('href'),
|
||||
|
@ -83,7 +83,7 @@ var browser_disable_item = function(el) {
|
|||
};
|
||||
|
||||
var browser_activate_item = function(el) {
|
||||
el.addEvent('click', function(e){
|
||||
el.addListener('click', function(e){
|
||||
if (e) {
|
||||
e.stop();
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ var browser_activate_item = function(el) {
|
|||
response = JSON.parse(response);
|
||||
ui_item.destroy();
|
||||
fd.message.alert(response.message_title, response.message);
|
||||
fd.fireEvent('activate_' + response.package_type);
|
||||
fd.emit('activate_' + response.package_type);
|
||||
},
|
||||
onFailure: function() {
|
||||
ui_item.removeClass(LOADING_CLASS);
|
||||
|
@ -107,7 +107,7 @@ var browser_activate_item = function(el) {
|
|||
};
|
||||
|
||||
var browser_delete_item = function(el) {
|
||||
el.addEvent('click', function(e){
|
||||
el.addListener('click', function(e){
|
||||
if (e) {
|
||||
e.stop();
|
||||
}
|
||||
|
@ -179,9 +179,9 @@ exports.init = function(fd_) {
|
|||
dom.$$('.UI_Activate a').forEach(browser_activate_item);
|
||||
dom.$$('.UI_Delete a').forEach(browser_delete_item);
|
||||
|
||||
fd.addEvent('activate_l', on_activate_library);
|
||||
fd.addEvent('deactivate_l', on_deactivate_library);
|
||||
fd.addEvent('activate_a', on_activate_addon);
|
||||
fd.addEvent('deactivate_a', on_deactivate_addon);
|
||||
fd.addListener('activate_l', on_activate_library);
|
||||
fd.addListener('deactivate_l', on_deactivate_library);
|
||||
fd.addListener('activate_a', on_activate_addon);
|
||||
fd.addListener('deactivate_a', on_deactivate_addon);
|
||||
};
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ exports.showQuestion = function(data) {
|
|||
}
|
||||
}
|
||||
});
|
||||
display.addEvent('destroy', function() {
|
||||
display.addListener('destroy', function() {
|
||||
keydownHandle.detach();
|
||||
});
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ module.exports = new Class({
|
|||
}
|
||||
|
||||
this.revision_list_btn = dom.$('revisions_list');
|
||||
this.revision_list_btn.addEvent('click', function(e) {
|
||||
this.revision_list_btn.addListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
controller.showRevisionList();
|
||||
});
|
||||
|
@ -124,14 +124,14 @@ module.exports = new Class({
|
|||
this.boundTestAddon = this.testAddon.bind(this);
|
||||
this.test_el = dom.$(this.options.test_el);
|
||||
this.options.test_url = this.test_el.getElement('a').get('href');
|
||||
this.test_el.addEvent('click', function(e) {
|
||||
this.test_el.addListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
controller.testAddon();
|
||||
});
|
||||
|
||||
this.download_el = dom.$(this.options.download_el);
|
||||
this.options.download_url = this.download_el.getElement('a').get('href');
|
||||
this.download_el.addEvent('click', function(e) {
|
||||
this.download_el.addListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
if (this.hasClass(LOADING_CLASS)) {
|
||||
return;
|
||||
|
@ -141,7 +141,7 @@ module.exports = new Class({
|
|||
}
|
||||
this.copy_el = dom.$(this.options.copy_el);
|
||||
if (this.copy_el) {
|
||||
this.copy_el.addEvent('click', function(e) {
|
||||
this.copy_el.addListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
if (this.hasClass(LOADING_CLASS)) {
|
||||
return;
|
||||
|
@ -150,12 +150,12 @@ module.exports = new Class({
|
|||
});
|
||||
}
|
||||
if (this.options.check_if_latest) {
|
||||
dom.window.addEvent('focus', function() {
|
||||
dom.window.addListener('focus', function() {
|
||||
controller.checkIfLatest(controller.askForReload);
|
||||
});
|
||||
}
|
||||
|
||||
fd().addEvent('xpi_downloaded', function() {
|
||||
fd().addListener('xpi_downloaded', function() {
|
||||
controller.generateHashtag();
|
||||
});
|
||||
|
||||
|
@ -175,7 +175,7 @@ module.exports = new Class({
|
|||
assignViewActions: function() {
|
||||
var controller = this;
|
||||
|
||||
this.packageInfoEl.addEvent('click', function(e) {
|
||||
this.packageInfoEl.addListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
controller.showInfo();
|
||||
});
|
||||
|
@ -184,18 +184,18 @@ module.exports = new Class({
|
|||
assignEditActions: function assignEditActions() {
|
||||
var controller = this;
|
||||
|
||||
dom.window.addEvent('beforeunload', function(e) {
|
||||
dom.window.addListener('beforeunload', function(e) {
|
||||
controller.alertUnsavedData(e);
|
||||
});
|
||||
|
||||
this.packageInfoEl.addEvent('click', function(e) {
|
||||
this.packageInfoEl.addListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
controller.editInfo();
|
||||
});
|
||||
|
||||
if (this.package_.isAddon()) {
|
||||
this.console_el = dom.$(this.options.console_el);
|
||||
this.console_el.addEvent('click', function(e) {
|
||||
this.console_el.addListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
var abh = dom.window.get('mozFlightDeck');
|
||||
if (abh) {
|
||||
|
@ -207,18 +207,18 @@ module.exports = new Class({
|
|||
}
|
||||
|
||||
this.save_el = dom.$(this.options.save_el);
|
||||
this.save_el.addEvent('click', function(e) {
|
||||
this.save_el.addListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
controller.saveAction();
|
||||
});
|
||||
|
||||
// when typing in Save popover, you should be able to tab in a
|
||||
// logical order
|
||||
this.save_el.addEvent('mouseenter', function(e) {
|
||||
this.save_el.addListener('mouseenter', function(e) {
|
||||
controller.versionEl.focus();
|
||||
});
|
||||
this.revision_message_el = dom.$('revision_message');
|
||||
this.revision_message_el.addEvent('keypress', function(e) {
|
||||
this.revision_message_el.addListener('keypress', function(e) {
|
||||
if (e.key === 'tab') {
|
||||
e.preventDefault();
|
||||
controller.save_el.focus();
|
||||
|
@ -231,7 +231,7 @@ module.exports = new Class({
|
|||
|
||||
this.sdkVersionEl = dom.$('jetpack_core_sdk_version');
|
||||
if (this.sdkVersionEl) {
|
||||
this.sdkVersionEl.addEvent('change', function() {
|
||||
this.sdkVersionEl.addListener('change', function() {
|
||||
var loader = dom.$('core_library_lib');
|
||||
loader.addClass(LOADING_CLASS).addClass('small');
|
||||
new Request({
|
||||
|
@ -299,7 +299,7 @@ module.exports = new Class({
|
|||
this.sidebar.addLib(mod);
|
||||
this.editor.registerItem(mod.get('uid'), mod);
|
||||
var controller = this;
|
||||
mod.addEvent('destroy', function() {
|
||||
mod.addListener('destroy', function() {
|
||||
delete controller.modules[this.get('uid')];
|
||||
});
|
||||
return mod;
|
||||
|
@ -326,7 +326,7 @@ module.exports = new Class({
|
|||
this.editor.registerItem(att.get('uid'), att);
|
||||
}
|
||||
|
||||
att.addEvent('destroy', function() {
|
||||
att.addListener('destroy', function() {
|
||||
delete controller.attachments[this.get('uid')];
|
||||
});
|
||||
return att;
|
||||
|
@ -344,7 +344,7 @@ module.exports = new Class({
|
|||
}
|
||||
|
||||
var controller = this;
|
||||
folder.addEvent('destroy', function() {
|
||||
folder.addListener('destroy', function() {
|
||||
delete controller.folders[this.get('uid')];
|
||||
});
|
||||
},
|
||||
|
@ -355,7 +355,7 @@ module.exports = new Class({
|
|||
this.sidebar.addPlugin(lib);
|
||||
|
||||
var controller = this;
|
||||
lib.addEvent('destroy', function() {
|
||||
lib.addListener('destroy', function() {
|
||||
delete controller.dependencies[this.get('uid')];
|
||||
});
|
||||
},
|
||||
|
@ -378,7 +378,7 @@ module.exports = new Class({
|
|||
modalEl.removeClass('boolean-on');
|
||||
}
|
||||
}
|
||||
showVersionsEl.addEvent('change', function(e) {
|
||||
showVersionsEl.addListener('change', function(e) {
|
||||
toggleVersionsOnly();
|
||||
});
|
||||
toggleVersionsOnly();
|
||||
|
@ -566,13 +566,13 @@ module.exports = new Class({
|
|||
return;
|
||||
}
|
||||
|
||||
this.editor.addEvent('change', function() {
|
||||
this.editor.addListener('change', function() {
|
||||
controller.onChanged();
|
||||
});
|
||||
|
||||
this.addEvent('change', this.onChanged);
|
||||
this.addEvent('save', this.onSaved);
|
||||
this.addEvent('reset', this.onReset);
|
||||
this.addListener('change', this.onChanged);
|
||||
this.addListener('save', this.onSaved);
|
||||
this.addListener('reset', this.onReset);
|
||||
},
|
||||
|
||||
attachSidebar: function() {
|
||||
|
@ -641,7 +641,7 @@ module.exports = new Class({
|
|||
if (file.isImage()) {
|
||||
template_middle += '<p></p>';
|
||||
img = new dom.Element('img', { src: file.get('get_url') });
|
||||
img.addEvent('load', function() {
|
||||
img.addListener('load', function() {
|
||||
if (target) {
|
||||
target.removeClass(LOADING_CLASS);
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ module.exports = new Class({
|
|||
|
||||
onSaved: function() {
|
||||
//any save specific logic?
|
||||
this.fireEvent('reset');
|
||||
this.emit('reset');
|
||||
},
|
||||
|
||||
onReset: function() {
|
||||
|
@ -1168,8 +1168,8 @@ module.exports = new Class({
|
|||
clearInterval(that.checkDependenciesInterval);
|
||||
}
|
||||
|
||||
dom.window.addEvent('focus', setCheckInterval);
|
||||
dom.window.addEvent('blur', unsetCheckInterval);
|
||||
dom.window.addListener('focus', setCheckInterval);
|
||||
dom.window.addListener('blur', unsetCheckInterval);
|
||||
setCheckInterval();
|
||||
|
||||
},
|
||||
|
@ -1232,7 +1232,7 @@ module.exports = new Class({
|
|||
onSuccess: function(text) {
|
||||
var response = JSON.parse(text);
|
||||
fd().message.alert(response.message_title, response.message);
|
||||
fd().fireEvent('activate_' + response.package_type);
|
||||
fd().emit('activate_' + response.package_type);
|
||||
activateButton.addClass('pressed').getElement('a').addClass('inactive');
|
||||
dom.$('UI_DisableLink').removeClass('pressed').getElement('a').removeClass('inactive');
|
||||
controller.package_.set('active', true);
|
||||
|
@ -1261,7 +1261,7 @@ module.exports = new Class({
|
|||
onSuccess: function(response) {
|
||||
response = JSON.parse(response);
|
||||
fd().message.alert(response.message_title, response.message);
|
||||
fd().fireEvent('disable_' + response.package_type);
|
||||
fd().emit('disable_' + response.package_type);
|
||||
deactivateButton.addClass('pressed').getElement('a').addClass('inactive');
|
||||
dom.$('UI_ActivateLink').removeClass('pressed').getElement('a').removeClass('inactive');
|
||||
controller.package_.set('active', false);
|
||||
|
@ -1282,21 +1282,21 @@ module.exports = new Class({
|
|||
fd().editPackageInfoModal = fd().displayModal(
|
||||
string.substitute(settings.edit_package_info_template,
|
||||
object.merge({}, this.data, this.options)));
|
||||
dom.$('full_name').addEvent('change', function() {
|
||||
fd().fireEvent('change');
|
||||
dom.$('full_name').addListener('change', function() {
|
||||
fd().emit('change');
|
||||
});
|
||||
dom.$('package_description').addEvent('change', function() {
|
||||
fd().fireEvent('change');
|
||||
dom.$('package_description').addListener('change', function() {
|
||||
fd().emit('change');
|
||||
});
|
||||
var savenow = dom.$('savenow');
|
||||
if (savenow) {
|
||||
savenow.addEvent('click', function() {
|
||||
savenow.addListener('click', function() {
|
||||
controller.savenow = true;
|
||||
});
|
||||
}
|
||||
|
||||
dom.$('UI_ActivateLink').getElement('a').addEvent('click', this.makePublic.bind(this));
|
||||
dom.$('UI_DisableLink').getElement('a').addEvent('click', this.makePrivate.bind(this));
|
||||
dom.$('UI_ActivateLink').getElement('a').addListener('click', this.makePublic.bind(this));
|
||||
dom.$('UI_DisableLink').getElement('a').addListener('click', this.makePrivate.bind(this));
|
||||
|
||||
// adjust button if package has been made private or public
|
||||
// since last page load
|
||||
|
@ -1315,7 +1315,7 @@ module.exports = new Class({
|
|||
pattern: /^[A-Za-z0-9\s\-_\.\(\)]*$/,
|
||||
message: 'Please use only letters, numbers, spaces, or "_().-" in this field.'
|
||||
});
|
||||
dom.$('package-info_form').addEvent('submit', function(e) {
|
||||
dom.$('package-info_form').addListener('submit', function(e) {
|
||||
e.stop();
|
||||
if (validator.validate()) {
|
||||
controller.submitInfo();
|
||||
|
@ -1438,7 +1438,7 @@ module.exports = new Class({
|
|||
this.installAddon();
|
||||
}
|
||||
this.editor.cleanChangeState();
|
||||
this.fireEvent('save');
|
||||
this.emit('save');
|
||||
}.bind(this),
|
||||
onComplete: function() {
|
||||
loader.removeClass(LOADING_CLASS);
|
||||
|
@ -1450,8 +1450,8 @@ module.exports = new Class({
|
|||
blur: function() {
|
||||
this._focused = false;
|
||||
this.editor.blur();
|
||||
this.fireEvent('blur');
|
||||
this.editor.addEvent('focus:once', function() {
|
||||
this.emit('blur');
|
||||
this.editor.addListener('focus:once', function() {
|
||||
if (!this._focused) {
|
||||
this.focus();
|
||||
}
|
||||
|
@ -1468,7 +1468,7 @@ module.exports = new Class({
|
|||
//this.keyboard.activate();
|
||||
this.editor.focus();
|
||||
|
||||
this.fireEvent('focus');
|
||||
this.emit('focus');
|
||||
},
|
||||
|
||||
/*bind_keyboard: function() {
|
||||
|
@ -1532,7 +1532,7 @@ module.exports = new Class({
|
|||
this.keyboard.manage(this.sidebar.keyboard);
|
||||
this.keyboard.activate();
|
||||
this.sidebar.keyboard.deactivate();
|
||||
this.addEvent('focus', function() {
|
||||
this.addListener('focus', function() {
|
||||
that.sidebar.blur();
|
||||
});
|
||||
},
|
||||
|
@ -1563,7 +1563,7 @@ module.exports = new Class({
|
|||
shortcuts.join('</p><p>')+
|
||||
'</p></div>'
|
||||
);
|
||||
this._shortcutsModal.addEvent('destroy', function() {
|
||||
this._shortcutsModal.addListener('destroy', function() {
|
||||
this._shortcutsModal = null;
|
||||
}.bind(this));
|
||||
},
|
||||
|
|
|
@ -25,7 +25,7 @@ module.exports = new Class({
|
|||
arrows: false,
|
||||
onTabDown: function(tab) {
|
||||
if (!tab.hasClass('selected')) {
|
||||
controller.fireEvent('select', tab.retrieve('tab:instance'));
|
||||
controller.emit('select', tab.retrieve('tab:instance'));
|
||||
}
|
||||
},
|
||||
onCloseDown: function(tabClose) {
|
||||
|
@ -64,7 +64,7 @@ module.exports = new Class({
|
|||
file.setChanged(false);
|
||||
fd.item.edited--;
|
||||
if(!fd.item.edited) {
|
||||
fd.item.fireEvent('reset');
|
||||
fd.item.emit('reset');
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ module.exports = new Class({
|
|||
tabEl.getPrevious('.tab') || tabEl.getNext('.tab') :
|
||||
dom.$(this.tabs).getElement('.tab.selected');
|
||||
if (nextTab) {
|
||||
this.tabs.fireEvent('tabDown', nextTab);
|
||||
this.tabs.emit('tabDown', nextTab);
|
||||
} else {
|
||||
//TODO: this should just show a "Open a file on the left"
|
||||
log.error('Another tab couldn\'t be found !');
|
||||
|
|
|
@ -67,16 +67,16 @@ var File = module.exports = new Class({
|
|||
setChanged: function(isChanged) {
|
||||
this.changed = isChanged;
|
||||
if (isChanged) {
|
||||
this.fireEvent('dirty');
|
||||
this.emit('dirty');
|
||||
} else {
|
||||
this.fireEvent('reset');
|
||||
this.emit('reset');
|
||||
}
|
||||
},
|
||||
|
||||
loadContent: function(callback) {
|
||||
var file = this;
|
||||
var spinnerEl;
|
||||
this.fireEvent('loadstart');
|
||||
this.emit('loadstart');
|
||||
return new Request({
|
||||
method: 'get',
|
||||
url: this.get('get_url'),
|
||||
|
@ -92,7 +92,7 @@ var File = module.exports = new Class({
|
|||
var content = text || '';
|
||||
file.original_content = content;
|
||||
file.set('content', content);
|
||||
file.fireEvent('loadcontent', content);
|
||||
file.emit('loadcontent', content);
|
||||
if (callback) {
|
||||
callback.call(this, content);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = new Class({
|
|||
|
||||
log.debug('loading content for module (uid:%s)', this.get('uid'));
|
||||
|
||||
this.fireEvent('loadstart');
|
||||
this.emit('loadstart');
|
||||
return new Request({
|
||||
method: 'get',
|
||||
url: this.get('get_url'),
|
||||
|
@ -47,7 +47,7 @@ module.exports = new Class({
|
|||
var code = mod.code || '';
|
||||
this.original_content = code;
|
||||
this.set('content', code);
|
||||
this.fireEvent('loadcontent', code);
|
||||
this.emit('loadcontent', code);
|
||||
if (callback) {
|
||||
callback.call(this, code);
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ function resetDom() {
|
|||
dom.$$('body *').dispose();
|
||||
|
||||
|
||||
fd.removeEvents();
|
||||
dom.window.removeEvents();
|
||||
fd.removeListeners();
|
||||
dom.window.removeListeners();
|
||||
|
||||
var body = dom.document.body;
|
||||
|
||||
|
@ -119,7 +119,7 @@ module.exports = {
|
|||
|
||||
pc.showRevisionList = new Spy();
|
||||
|
||||
pc.revision_list_btn.fireEvent('click', new E('click'));
|
||||
pc.revision_list_btn.emit('click', new E('click'));
|
||||
expect(pc.showRevisionList.getCallCount()).toBe(1);
|
||||
});
|
||||
|
||||
|
@ -152,7 +152,7 @@ module.exports = {
|
|||
it('should be bound to testAddon', function(expect) {
|
||||
var pc = new PackageController(addon, editOptions);
|
||||
pc.testAddon = new Spy();
|
||||
pc.test_el.fireEvent('click', new E('click'));
|
||||
pc.test_el.emit('click', new E('click'));
|
||||
expect(pc.testAddon.getCallCount()).toBe(1);
|
||||
});
|
||||
|
||||
|
@ -164,21 +164,21 @@ module.exports = {
|
|||
it('should be bound to downloadAddon', function(expect) {
|
||||
var pc = new PackageController(addon, editOptions);
|
||||
pc.downloadAddon = new Spy();
|
||||
pc.download_el.fireEvent('click', new E('click'));
|
||||
pc.download_el.emit('click', new E('click'));
|
||||
expect(pc.downloadAddon.getCallCount()).toBe(1);
|
||||
});
|
||||
|
||||
it('should be bound to copyPackage', function(expect) {
|
||||
var pc = new PackageController(addon, editOptions);
|
||||
pc.copyPackage = new Spy();
|
||||
pc.copy_el.fireEvent('click', new E('click'));
|
||||
pc.copy_el.emit('click', new E('click'));
|
||||
expect(pc.copyPackage.getCallCount()).toBe(1);
|
||||
});
|
||||
|
||||
it('should be bound to checkIfLatest on window.focus', function(expect) {
|
||||
var pc = new PackageController(addon, editOptions);
|
||||
pc.checkIfLatest = new Spy();
|
||||
dom.window.fireEvent('focus', new E('focus'));
|
||||
dom.window.emit('focus', new E('focus'));
|
||||
expect(pc.checkIfLatest.getCallCount()).toBe(1);
|
||||
});
|
||||
|
||||
|
@ -188,14 +188,14 @@ module.exports = {
|
|||
check_dependencies: false
|
||||
});
|
||||
pc.checkIfLatest = new Spy();
|
||||
dom.window.fireEvent('focus', new E('focus'));
|
||||
dom.window.emit('focus', new E('focus'));
|
||||
expect(pc.checkIfLatest.getCallCount()).toBe(0);
|
||||
});
|
||||
|
||||
it('should be bound to showInfo', function(expect) {
|
||||
var pc = new PackageController(addon, { readonly: true });
|
||||
pc.showInfo = new Spy();
|
||||
pc.packageInfoEl.fireEvent('click', new E('click'));
|
||||
pc.packageInfoEl.emit('click', new E('click'));
|
||||
expect(pc.showInfo.getCallCount()).toBe(1);
|
||||
});
|
||||
|
||||
|
@ -205,7 +205,7 @@ module.exports = {
|
|||
it('should be bound to editInfo', function(expect) {
|
||||
var pc = new PackageController(addon, editOptions);
|
||||
pc.editInfo = new Spy();
|
||||
pc.packageInfoEl.fireEvent('click', new E('click'));
|
||||
pc.packageInfoEl.emit('click', new E('click'));
|
||||
expect(pc.editInfo.getCallCount()).toBe(1);
|
||||
});
|
||||
|
||||
|
@ -214,7 +214,7 @@ module.exports = {
|
|||
dom.window.node.mozFlightDeck = fd;
|
||||
|
||||
var pc = new PackageController(addon, editOptions);
|
||||
pc.console_el.fireEvent('click', new E('click'));
|
||||
pc.console_el.emit('click', new E('click'));
|
||||
expect(fd.send).toHaveBeenCalled();
|
||||
expect(fd.send.getLastArgs()).toBeLike(['toggleConsole', 'open']);
|
||||
|
||||
|
@ -224,14 +224,14 @@ module.exports = {
|
|||
it('should bind save_el to saveAction', function(expect) {
|
||||
var pc = new PackageController(addon, editOptions);
|
||||
pc.saveAction = new Spy();
|
||||
pc.save_el.fireEvent('click', new E('click'));
|
||||
pc.save_el.emit('click', new E('click'));
|
||||
expect(pc.saveAction.getCallCount()).toBe(1);
|
||||
});
|
||||
|
||||
it('should bind to onbeforeunload', function(expect) {
|
||||
var pc = new PackageController(addon, editOptions);
|
||||
pc.alertUnsavedData = new Spy();
|
||||
dom.window.fireEvent('beforeunload', new E('beforeunload'));
|
||||
dom.window.emit('beforeunload', new E('beforeunload'));
|
||||
expect(pc.alertUnsavedData.getCallCount()).toBe(1);
|
||||
});
|
||||
|
||||
|
@ -252,19 +252,19 @@ module.exports = {
|
|||
|
||||
// jury-rig the .focus() methods to trigger our event
|
||||
// handlers
|
||||
pc.versionEl.focus = function() { this.fireEvent('focus', new E('focus')); };
|
||||
pc.versionEl.focus = function() { this.emit('focus', new E('focus')); };
|
||||
pc.save_el.focus = pc.versionEl.focus;
|
||||
|
||||
pc.versionEl.addEvent('focus', versionFocus);
|
||||
pc.save_el.addEvent('focus', saveFocus);
|
||||
pc.versionEl.addListener('focus', versionFocus);
|
||||
pc.save_el.addListener('focus', saveFocus);
|
||||
|
||||
pc.save_el.fireEvent('mouseenter', new E('mouseenter'));
|
||||
pc.save_el.emit('mouseenter', new E('mouseenter'));
|
||||
expect(versionFocus.getCallCount()).toBe(1);
|
||||
|
||||
var tab = new E('keypress');
|
||||
tab.keyCode = 9;
|
||||
//tab.key = 'tab';
|
||||
pc.revision_message_el.fireEvent('keypress', tab);
|
||||
pc.revision_message_el.emit('keypress', tab);
|
||||
expect(saveFocus.getCallCount()).toBe(1);
|
||||
});
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ module.exports = {
|
|||
mockXHR(mod);
|
||||
var m = new Module();
|
||||
var fn = new Spy();
|
||||
m.addEvent('loadcontent', fn);
|
||||
m.addListener('loadcontent', fn);
|
||||
m.loadContent(function(content) {
|
||||
expect(content).toBe(mod.code);
|
||||
expect(m.get('content')).toBe(mod.code);
|
||||
|
|
|
@ -153,7 +153,7 @@ var FDEditor = module.exports = new Class({
|
|||
},
|
||||
|
||||
unhookChange: function(){
|
||||
this.element.removeEvent('keyup', this.boundWhenItemChanged);
|
||||
this.element.removeListener('keyup', this.boundWhenItemChanged);
|
||||
this.change_hooked = false;
|
||||
log.info('No longer following changes');
|
||||
},
|
||||
|
|
|
@ -176,11 +176,11 @@ var FileTree = module.exports = new Class({
|
|||
label.store('$text', text);
|
||||
|
||||
label.store('$blur', function blur(e) {
|
||||
label.removeEvent('blur', blur);
|
||||
label.removeListener('blur', blur);
|
||||
this.renameBranchCancel(element);
|
||||
}.bind(this));
|
||||
|
||||
label.addEvent('blur', label.retrieve('$blur'));
|
||||
label.addListener('blur', label.retrieve('$blur'));
|
||||
|
||||
hasExtension = hasExtension || !!filename.extname(text);
|
||||
|
||||
|
@ -228,7 +228,7 @@ var FileTree = module.exports = new Class({
|
|||
return this;
|
||||
}
|
||||
|
||||
label.removeEvent('blur', label.retrieve('$blur'));
|
||||
label.removeListener('blur', label.retrieve('$blur'));
|
||||
label.unstore('$text');
|
||||
label.set('contenteditable', false).blur();
|
||||
dom.window.getNode().getSelection().removeAllRanges();
|
||||
|
|
|
@ -66,7 +66,7 @@ module.exports = new Class({
|
|||
evs[s.options.hideOn] = function() {
|
||||
s.hide(e);
|
||||
};
|
||||
e.addEvents(evs);
|
||||
e.addListeners(evs);
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
@ -83,7 +83,7 @@ module.exports = new Class({
|
|||
}
|
||||
element.store(STORE_TIP, tip);
|
||||
this._animate(tip, 'in');
|
||||
this.fireEvent('show', tip, element);
|
||||
this.emit('show', tip, element);
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -93,7 +93,7 @@ module.exports = new Class({
|
|||
return this;
|
||||
}
|
||||
this._animate(tip, 'out');
|
||||
this.fireEvent('hide', [tip, element]);
|
||||
this.emit('hide', tip, element);
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
|
@ -292,10 +292,10 @@ var Sidebar = module.exports = new Class({
|
|||
|
||||
// file.onChange should add an asterisk to the tree branch
|
||||
// file.onReset should remove the asterisk
|
||||
file.addEvent('dirty', function() {
|
||||
file.addListener('dirty', function() {
|
||||
element.addClass(that.options.file_modified_class);
|
||||
});
|
||||
file.addEvent('reset', function() {
|
||||
file.addListener('reset', function() {
|
||||
element.removeClass(that.options.file_modified_class);
|
||||
});
|
||||
|
||||
|
@ -398,7 +398,7 @@ var Sidebar = module.exports = new Class({
|
|||
|
||||
var emptydir = node.retrieve('file');
|
||||
if (emptydir instanceof Folder) {
|
||||
emptydir.removeEvent('destroy', emptydir._removeFromTree);
|
||||
emptydir.removeListener('destroy', emptydir._removeFromTree);
|
||||
node.unstore('file');
|
||||
emptydir.destroy();
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ var Sidebar = module.exports = new Class({
|
|||
isFolder = false;
|
||||
});
|
||||
|
||||
folderBtn.addEvent('click', function(e) {
|
||||
folderBtn.addListener('click', function(e) {
|
||||
e.stop();
|
||||
fileBtn.removeClass('selected');
|
||||
this.addClass('selected');
|
||||
|
|
|
@ -194,7 +194,7 @@ module.exports = new Class({
|
|||
this.collapse.updateElement(drop.target);
|
||||
}
|
||||
|
||||
this.fireEvent('change');
|
||||
this.emit('change');
|
||||
},
|
||||
|
||||
setDropTarget: function(drop) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 91953b345cf8868a82f839b3b05aefcdf03cb48f
|
||||
Subproject commit b3f9a3308cd20746cffb6c70ea3c10c59203c562
|
|
@ -199,7 +199,7 @@ module.exports = new Class({
|
|||
var step = this.step;
|
||||
if (this.previousChange !== step) {
|
||||
this.previousChange = step;
|
||||
this.fireEvent('change', step);
|
||||
this.emit('change', step);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче