/* A helper method that is run for all addListener methods
345502
function addListener(attr,func,child,update)
        {
          if(typeof func !== 'function') return bind;

          var isInput = (['value','checked'].indexOf(attr) !== -1),
              isStyle = (_allStyles.indexOf(attr) !== -1),
              listeners;

          if(this.toString() !== bind.toString())
          {
            if(child)
            {
              var children = this.querySelectorAll('*'),
                  len = children.length,
                  listenerObj;
              for(var x=0;x<len;x++)
              {
                listenerObj = children[x].attrListeners();
                if(isInput || (attr === _all))
                {
                  if(children[x].addInputBinding !== undefined) children[x].addInputBinding();
                  if(children[x].addInputBoxBinding !== undefined) children[x].addInputBoxBinding();
                }
                if(isStyle)
                {
                  bind.injectStyleProperty(children[x],attr);
                  listeners = (update ? '_parentStyleUpdateListeners' : '_parentStyleListeners');
                  if(listenerObj[listeners][attr] === undefined) listenerObj[listeners][attr] = [];
                  listenerObj[listeners][attr].push({parent:this,func:func});
                }
                else
                {
                  if(attr === _all)
                  {
                    listeners = (update ? '_parentStyleUpdateListeners' : '_parentStyleListeners');
                    var len = _allStyles.length;
                    for(var i = 0;i<len;i++)
                    {
                      bind.injectStyleProperty(children[x],_allStyles[i]);
                    }
                    if(listenerObj[listeners][_all] === undefined) listenerObj[listeners][_all] = [];
                      listenerObj[listeners][_all].push({parent:this,func:func});
                  }
                  listeners = (update ? '_parentAttrUpdateListeners' : '_parentAttrListeners');
                  if(listenerObj[listeners][attr] === undefined) listenerObj[listeners][attr] = [];
                  listenerObj[listeners][attr].push({parent:this,func:func});
                }
              }
            }
            else
            {
              listenerObj = this.attrListeners();
              if(isStyle)
              {
                listeners = (update ? '_styleUpdateListeners' : '_styleListeners');
                bind.injectStyleProperty(this,attr);
                if(listenerObj[listeners][attr] === undefined) listenerObj[listeners][attr] = [];
                listenerObj[listeners][attr].push(func);
              }
              else
              {
                if(isInput || (attr === _all))
                {
                  if(this.addInputBinding !== undefined) this.addInputBinding();
                  if(this.addInputBoxBinding !== undefined) this.addInputBoxBinding();
                }
                if(attr === _all)
                {
                  listeners = (update ? '_styleUpdateListeners' : '_styleListeners');
                  var len = _allStyles.length;
                  for(var x = 0;x<len;x++)
                  {
                    bind.injectStyleProperty(this,_allStyles[x]);
                  }
                  if(listenerObj[listeners][attr] === undefined) listenerObj[listeners][attr] = [];
                  listenerObj[listeners][attr].push(func);
                }
                listeners = (update ? '_attrUpdateListeners' : '_attrListeners');
                if(listenerObj[listeners][attr] === undefined) listenerObj[listeners][attr] = [];
                listenerObj[listeners][attr].push(func);
              }
            }
          }
          else
          {
            if(isInput || (attr === _all))
            {
              var inputs = document.querySelectorAll('input, textarea'),
                  len = inputs.length;
              for(var x=0;x<len;x++)
              {
                if(inputs[x].addInputBinding !== undefined) inputs[x].addInputBinding();
                if(inputs[x].addInputBoxBinding !== undefined) inputs[x].addInputBoxBinding();
              }
            }
            if(isStyle)
            {
              var els = Array.prototype.slice.call(document.body.querySelectorAll('*')),
                  len = (els.length+1);
              els.unshift(document.body);
              for(var x=0;x<len;x++)
              {
                bind.injectStyleProperty(els[x],attr);
              }
              listeners = (update ? _styleUpdateListeners : _styleListeners);
              if(listeners[attr] === undefined) listeners[attr] = [];
              listeners[attr].push(func);
            }
            else
            {
              if(attr === _all)
              {
                var els = Array.prototype.slice.call(document.body.querySelectorAll('*')),
                    len = (els.length+1),
                    lenStyles = _allStyles.length;
                els.unshift(document.body);
                for(var x=0;x<len;x++)
                {
                  for(var i=0;i<lenStyles;i++)
                  {
                    bind.injectStyleProperty(els[x],_allStyles[i]);
                  }
                }
                listeners = (update ? _styleUpdateListeners : _styleListeners);
                if(listeners[attr] === undefined) listeners[attr] = [];
                listeners[attr].push(func);
              }
              listeners = (update ? _attrUpdateListeners : _attrListeners);
              if(listeners[attr] === undefined) listeners[attr] = [];
              listeners[attr].push(func);
            }
          }
        }
406847
public void addListeners()
    {
        super.addListeners();
        this.addMainKeyBehavior();
        this.getMainRecord().getField(ClassInfo.CLASS_NAME).addListener(new MainFieldHandler(ClassInfo.CLASS_NAME_KEY));
        this.getMainRecord().addListener(new EnableOnPhysicalHandler(null));
        this.getMainRecord().getField(ClassInfo.CLASS_NAME).addListener(new MoveOnChangeHandler(this.getMainRecord().getField(ClassInfo.CLASS_SOURCE_FILE), this.getMainRecord().getField(ClassInfo.CLASS_NAME), false, true));
        
        this.getMainRecord().addListener(new FileListener(null)
        {
            public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
            {
                int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
                if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) || (iChangeType == DBConstants.AFTER_ADD_TYPE))
                {
                    Record classInfo = getMainRecord();
                    TaskScheduler js = BaseApplet.getSharedInstance().getApplication().getTaskScheduler();
                    String strJob = Utility.addURLParam(null, DBParams.PROCESS, ".app.program.manual.util.WriteClasses");
                    strJob = Utility.addURLParam(strJob, "fileName", classInfo.getField(ClassInfo.CLASS_SOURCE_FILE).toString());
                    strJob = Utility.addURLParam(strJob, "package", classInfo.getField(ClassInfo.CLASS_PACKAGE).toString());
                    strJob = Utility.addURLParam(strJob, "project", Converter.stripNonNumber(classInfo.getField(ClassInfo.CLASS_PROJECT_ID).toString()));
                    strJob = Utility.addURLParam(strJob, DBParams.TASK, ProcessRunnerTask.class.getName()); // Screen class
                    js.addTask(strJob);                    
                }
                return iErrorCode;
            };
            
        });
        
        DateChangedHandler dateChangedHandler = (DateChangedHandler)this.getMainRecord().getListener(DateChangedHandler.class);
        if (dateChangedHandler == null)
            this.getMainRecord().addListener(dateChangedHandler = new DateChangedHandler((DateTimeField)this.getMainRecord().getField(ClassInfo.LAST_CHANGED)));
        dateChangedHandler.setOnFieldChange(true);
    }
646546
@Override
    public void addListeners(TrainingListener... listeners) {
        if (this.trainingListeners == null) {
            setListeners(listeners);
            return;
        } else {
            List<TrainingListener> newListeners = new ArrayList<>(this.trainingListeners);   //To avoid immutable list issues
            Collections.addAll(newListeners, listeners);
            setListeners(newListeners);
        }

        if (solver != null) {
            solver.setListeners(this.trainingListeners);
        }
    }
659856
function loadedListener() {
            var readyState = script.readyState;
            if (
                typeof readyState === 'undefined'
                || /^(loaded|complete)$/.test( readyState )
            ) {
                script.onload = script.onreadystatechange = null;
                script = null;

                completePreDefine( moduleId );
            }
        }
1211316
function addListener(type, listener, context) {

		var typeName,
		    filter,
		    target,
		    entry;

		// Throw an error if no valid listener function is given
		if (typeof listener !== 'function') {
			throw TypeError('listener must be a function');
		}

		// Get the typename & filter data
		if (typeof type === 'string') {
			target = this.simpleListeners;
			typeName = type;
			entry = [listener, null, context||null];
		} else {
			target = this.filterListeners;

			if (typeof type.type === 'string') {
				typeName = type.type;
			} else {
				typeName = '';
			}

			filter = type;
			entry = [listener, filter, context||null];
		}

		// Emit the 'newListener' event
		if (this.simpleListeners.newListener || this.filterListeners.newListener) {
			this.emit('newListener', type, listener.listener ? listener.listener : listener, typeName);
		}

		if (!target[typeName]) {
			target[typeName] = [];
			this.listenTypes.push(typeName);
		}

		target[typeName].push(entry);

		return this;
	}
492503
function addListener(event, callback) {
    checkEventValid(event);

    if (listeners[event]) {
        listeners[event].push(callback);
    } else {
        listeners[event] = [callback];
    }
}
1313709
function setListener(callback) {
    if (onFinish) {
      throw new Error('thenDo/finally called more than once');
    }
    if (finished) {
      onFinish = function() {};
      callback(finished.err, finished.result);
    } else {
      onFinish = function() {
        callback(finished.err, finished.result);
      };
    }
  }
50753
function addListeners (node) {
  const model = findModel(node);
  // cache the input eventName.
  this._inputEventName = this._inputEventName || getInputEventName(node, model);

  onRenderUpdate.call(this, model);

  const { onInput, onBlur, onValidate } = createCommonHandlers(this);
  addVNodeListener(node, this._inputEventName, onInput);
  addVNodeListener(node, 'blur', onBlur);

  // add the validation listeners.
  this.normalizedEvents.forEach(evt => {
    addVNodeListener(node, evt, onValidate);
  });

  this.initialized = true;
}
381162
public void addListeners()
    {
        super.addListeners();
        
        this.getField(Person.NAME).removeListener(this.getField(Person.NAME).getListener(CopyLastHandler.class), true);    // Only if dest is null (ie., company name is null)
        this.getField(Person.NAME).addListener(new CopyFieldHandler(this.getField(Person.NAME_SORT)));
        this.getField(Company.NAME_SORT).addListener(new CheckForTheHandler(null));
        
        CopyLastHandler listener = new CopyLastHandler(this.getField(Company.NAME_SORT));
        this.getField(Company.CONTACT).addListener(listener);    // Only if dest is null (ie., company name is null)
        listener.setOnlyIfDestNull(true);
    }
944996
function (node, property, recursive, listeners) {
        // add property specific recursive listeners
        listeners = __appendListeners(node[__getListenerMetaName(property, true)], listeners);
        if (!recursive) {
            // add property specific non-recursive listeners
            listeners = __appendListeners(node[__getListenerMetaName(property)], listeners);
        }
        return listeners;
    }
836496
public void addListener(ILabelProviderListener listener)
	{
		if (fLabelDecorators != null)
		{
			for (int i = 0; i < fLabelDecorators.size(); i++)
			{
				ILabelDecorator decorator = (ILabelDecorator) fLabelDecorators.get(i);
				decorator.addListener(listener);
			}
		}
		fListeners.add(listener);
	}
633396
function addListener(uid) {
		var addedListener = false;
		if(typeof(dashboardListeners[uid]) === 'undefined') {
			dashboardListeners[uid] = {
				'startTime': new Date(),
				'numIterations': 0,
				'uid': uid,
				'numStarts': 1,
			};
			addedListener = true;
		} else {
			// Don't add the listener.
			dashboardListeners[uid].numStarts += 1;
		}
		return addedListener;
	}
974517
public void addListeners()
    {
        super.addListeners();
        this.setEnabled(true);
        this.getRecord(Resource.RESOURCE_FILE).getField(Resource.CODE).setEnabled(false);
    }
129209
function addListener(object, fName, event, listener) {
		listeners.push({
			object: object[fName](event, listener),
			event: event,
			listener: listener,
		})
	}
1166942
public void addListeners()
    {
        super.addListeners();
        this.getMainRecord().getField(Appointment.CALENDAR_CATEGORY_ID).addListener(new InitFieldHandler(this.getRecord(CalendarControl.CALENDAR_CONTROL_FILE).getField(CalendarControl.APPOINTMENT_CATEGORY_ID)));
    }
182448
function addListener(target, eventType, fn) {
		target.attachEvent(eventType, fn);
		listenersArr[listenersArr.length] = [target, eventType, fn];
	}
434768
function recursiveRemoveListeners(listeners: Object | any[]) {
  if (Array.isArray(listeners)) {
    listeners.forEach((listener, index) =>
      recursiveRemoveListeners(listener)
    );
  } else if (listeners instanceof ListenerTracker) {
    const id = listeners.id;
    const object = listeners.object;
    object._parent
        ? object._parent.removeListener(id)
        : object.removeListener(id);
  } else if (typeof listeners === 'object' && listeners !== null) {
    Object.keys(listeners).forEach(key =>
      recursiveRemoveListeners(listeners[key])
    );
  }
}