1 /* 2 * ***** BEGIN LICENSE BLOCK ***** 3 * Zimbra Collaboration Suite Web Client 4 * Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011, 2013, 2014, 2016 Synacor, Inc. 5 * 6 * The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at: https://www.zimbra.com/license 9 * The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 10 * have been added to cover use of software over a computer network and provide for limited attribution 11 * for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B. 12 * 13 * Software distributed under the License is distributed on an "AS IS" basis, 14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. 15 * See the License for the specific language governing rights and limitations under the License. 16 * The Original Code is Zimbra Open Source Web Client. 17 * The Initial Developer of the Original Code is Zimbra, Inc. All rights to the Original Code were 18 * transferred by Zimbra, Inc. to Synacor, Inc. on September 14, 2015. 19 * 20 * All portions of the code are Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011, 2013, 2014, 2016 Synacor, Inc. All Rights Reserved. 21 * ***** END LICENSE BLOCK ***** 22 */ 23 24 25 /** 26 * Creates a new listener. 27 * @constructor 28 * @class 29 * This class represents a listener, which is a function to be called in response to an event. 30 * A listener is a slightly specialized callback: it has a {@link #handleEvent} method, and it does not 31 * return a value. 32 * 33 * @author Ross Dargahi 34 * 35 * @param {Object} obj the object to call the function from 36 * @param {function} func the listener function 37 * @param {primative|array} args the default arguments 38 * 39 * @extends AjxCallback 40 */ 41 AjxListener = function(obj, method, args) { 42 AjxCallback.call(this, obj, method, args); 43 } 44 45 AjxListener.prototype = new AjxCallback(); 46 AjxListener.prototype.constructor = AjxListener; 47 48 AjxListener.prototype.isAjxListener = true; 49 AjxListener.prototype.toString = function() { return "AjxListener"; } 50 51 /** 52 * Invoke the listener function. 53 * 54 * @param {AjxEvent} ev the event object that gets passed to an event handler 55 */ 56 AjxListener.prototype.handleEvent = 57 function(ev) { 58 return this.run(ev); 59 } 60