Sets up any watchers used by autocomplete
771669
function configureWatchers () {
    var wait = parseInt($scope.delay, 10) || 0;

    $attrs.$observe('disabled', function (value) { ctrl.isDisabled = $mdUtil.parseAttributeBoolean(value, false); });
    $attrs.$observe('required', function (value) { ctrl.isRequired = $mdUtil.parseAttributeBoolean(value, false); });
    $attrs.$observe('readonly', function (value) { ctrl.isReadonly = $mdUtil.parseAttributeBoolean(value, false); });

    $scope.$watch('searchText', wait ? $mdUtil.debounce(handleSearchText, wait) : handleSearchText);
    $scope.$watch('selectedItem', selectedItemChange);

    angular.element($window).on('resize', debouncedOnResize);

    $scope.$on('$destroy', cleanup);
  }
961532
def _call_watcher(self_, watcher, event):
        
        if self_.self_or_cls.param._TRIGGER:
            pass
        elif watcher.onlychanged and (not self_._changed(event)):
            return

        if self_.self_or_cls.param._BATCH_WATCH:
            self_._events.append(event)
            if watcher not in self_._watchers:
                self_._watchers.append(watcher)
        elif watcher.mode == 'args':
            with batch_watch(self_.self_or_cls, run=False):
                watcher.fn(self_._update_event_type(watcher, event, self_.self_or_cls.param._TRIGGER))
        else:
            with batch_watch(self_.self_or_cls, run=False):
                event = self_._update_event_type(watcher, event, self_.self_or_cls.param._TRIGGER)
                watcher.fn(**{event.name: event.new})
1022763
private void onAutoCompleted(final Event event, final Suggestion<T> suggestion) {
        TypeaheadAutoCompletedEvent.fire(this, suggestion, event);
    }
885297
public function autocomplete()
    {
        $this->loadComponent('RequestHandler');
        $this->viewClass = 'Json';
        $data = [];
        $paramName = $this->request->query('parameter');
        $query = $this->request->query('query');
        $parameter = $this->Filter->parameters()->get($paramName);
        if (!empty($parameter)) {
            $method = $parameter->config('autocompleteAction');
            $data = $method($query);
            $this->set('status', 'success');
        } else {
            $this->set('status', 'error');
            $this->set('message', __('Field not found'));
        }
        $this->set('data', $data);
        $this->set('_serialize', ['data', 'status', 'message']);
    }
285254
function(suggestions, completer, token) {
    var hintList = [];
    for (var i = 0; i < suggestions.length; i++) {
      var suggestedString = suggestions[i];
      if (completer.postProcessToken) {
        suggestedString = completer.postProcessToken(token, suggestedString);
      }
      hintList.push({
        text: suggestedString,
        displayText: suggestedString,
        hint: selectHint
      });
    }

    var cur = yasqe.getCursor();
    var returnObj = {
      completionToken: token.string,
      list: hintList,
      from: {
        line: cur.line,
        ch: token.start
      },
      to: {
        line: cur.line,
        ch: token.end
      }
    };
    //if we have some autocompletion handlers specified, add these these to the object. Codemirror will take care of firing these
    if (completer.callbacks) {
      for (var callbackName in completer.callbacks) {
        if (completer.callbacks[callbackName]) {
          YASQE.on(returnObj, callbackName, completer.callbacks[callbackName]);
        }
      }
    }
    return returnObj;
  }
1366701
def _set_listener(instance, obs):
    """"""
    if obs.names is everything:
        names = list(instance._props)
    else:
        names = obs.names
    for name in names:
        if name not in instance._listeners:
            instance._listeners[name] = {typ: [] for typ in LISTENER_TYPES}
        instance._listeners[name][obs.mode] += [obs]
1206646
public void watch(Watcher watcher) throws WatchException{
		if(isClosed){
			throw new WatchException("Watch Monitor is closed !");
		}
		registerPath();
//		log.debug("Start watching path: [{}]", this.path);
		
		while (false == isClosed) {
			WatchKey wk;
			try {
				wk = watchService.take();
			} catch (InterruptedException e) {
//				log.warn(e);
				return;
			}
			
			final Path currentPath = watchKeyPathMap.get(wk);
			WatchEvent.Kind<?> kind;
			for (WatchEvent<?> event : wk.pollEvents()) {
				kind = event.kind();
				if(null != this.filePath && false == this.filePath.endsWith(event.context().toString())){
//					log.debug("[{}] is not fit for [{}], pass it.", event.context(), this.filePath.getFileName());
					continue;
				}
				
				if(kind == StandardWatchEventKinds.ENTRY_CREATE){
					watcher.onCreate(event, currentPath);
				}else if(kind == StandardWatchEventKinds.ENTRY_MODIFY){
					watcher.onModify(event, currentPath);
				}else if(kind == StandardWatchEventKinds.ENTRY_DELETE){
					watcher.onDelete(event, currentPath);
				}else if(kind == StandardWatchEventKinds.OVERFLOW){
					watcher.onOverflow(event, currentPath);
				}
			}
			wk.reset();
		}
	}
575571
function doOnScopeChange(scope, watchers, cb) {
        var i, watchExp, firstChar, handler;

        // set up the watchers if they exist
        if (watchers && cb) {
            for (i = 0; i < watchers.length; i++) {
                handler = generateScopeChangeHandler(cb, watchers);
                watchExp = watchers[i];
                firstChar = watchExp.charAt(0);
                if (firstChar === '^') {
                    scope.$watchCollection(watchExp.substring(1), handler);
                }
                else if (firstChar === '*') {
                    scope.$watch(watchExp.substring(1), handler, true);
                }
                else {
                    scope.$watch(watchExp, handler);
                }
            }
        }
    }
869684
private void processWatchers(MethodSpec.Builder createdMethodBuilder) {
    createdMethodBuilder.addStatement("Proto p = __proto__");
    getMethodsWithAnnotation(component, Watch.class)
        .forEach(method -> processWatcher(createdMethodBuilder, method));
  }
1346406
public function setComplete()
    {
        if (!$this->isStaticComplete()) {
            $this->setStaticComplete();
        }
        $this->complete = true;
        $this->emit('complete');
    }
1084265
function beginWatch() {
    let watchPaths = []
    let outputs = []

    util.each(cfgArr, function(config) {
      outputs = outputs.concat(config.output)
      watchPaths = watchPaths.concat(config.files)
      watchPaths = watchPaths.concat(config.libPaths)
    })

    chokidar
      .watch(watchPaths, {
        persistent: true,
        ignored: outputs,
        ignoreInitial: true,
        followSymlinks: true,
        usePolling: true,
        alwaysStat: false,
        interval: 100,
        atomic: true,
        ignorePermissionErrors: false
      })
      .on('change', function() {
        i = 0
        build(cfgArr[i], true)
      })
  }
1221514
def eventFilter(self, watchedObject, event):
        
        if event.type() == QtCore.QEvent.KeyPress:
            key = event.key()
            if key in (Qt.Key_Tab, Qt.Key_Backtab):
                self.commitAndClose()
                return True
            else:
                return False

        return super(AbstractCtiEditor, self).eventFilter(watchedObject, event)
445287
def register_click_watcher(self, watcher_name, selectors, *condition_list):
        
        watcher = self.device.watcher(watcher_name)
        for condition in condition_list:
            watcher.when(**self.__unicode_to_dict(condition))
        watcher.click(**self.__unicode_to_dict(selectors))
        self.device.watchers.run()
334241
function(params, callback) {
      var t = this;
      if (typeof(params) !== 'string' || params.length < 1) {
        callback("Autocomplete paramter must be a nonzero string");
      }

      // Forward to the completion mechanism if it can be completed
      if (params.substr(-1).match(/([0-9])|([a-z])|([A-Z])|([_])/)) {
        t.repl.complete(params, callback);
      } else {
        // Return a no-op autocomplete
        callback(null, [[],'']);
      }
    }
1239006
protected void setAutocomplete(final String autocompleteValue) {
		final String newValue = Util.empty(autocompleteValue) ? null : autocompleteValue;
		if (!Util.equals(newValue, getAutocomplete())) {
			getOrCreateComponentModel().autocomplete = newValue;
		}
	}
22977
def _batch_call_watchers(self_):
        
        while self_.self_or_cls.param._events:
            event_dict = OrderedDict([((event.name, event.what), event)
                                      for event in self_.self_or_cls.param._events])
            watchers = self_.self_or_cls.param._watchers[:]
            self_.self_or_cls.param._events = []
            self_.self_or_cls.param._watchers = []

            for watcher in watchers:
                events = [self_._update_event_type(watcher, event_dict[(name, watcher.what)],
                                                   self_.self_or_cls.param._TRIGGER)
                          for name in watcher.parameter_names
                          if (name, watcher.what) in event_dict]
                with batch_watch(self_.self_or_cls, run=False):
                    if watcher.mode == 'args':
                        watcher.fn(*events)
                    else:
                        watcher.fn(**{c.name:c.new for c in events})
671070
function setupWatchers(path) {
    // We want to track the watchers now and return if we are already watching this folder
    if (watchingFolders[path]) { return; }

    watchingFolders[path] = fs.watch(path, getWatcher(path + "/"));
    watchingFolders[path].on('error', function() {  verifyWatches(); });
    var fileList = fs.readdirSync(path);
    var stats;
    for (var i = 0; i < fileList.length; i++) {
        try {
            stats = fs.statSync(path + "/" + fileList[i]);
        }
        catch (e) {
            continue;
        }
        if (isWatching(fileList[i])) {
            timeStamps[path + "/" + fileList[i]] = stats.mtime.getTime();
        } else {
            if (stats.isDirectory()) {
                if (fileList[i] === "node_modules") {
                    watchingFolders[path + "/" + fileList[i]] = true;
                    continue;
                }
                if (fileList[i] === "tns_modules") {
                    watchingFolders[path + "/" + fileList[i]] = true;
                    continue;
                }
                if (fileList[i] === "App_Resources") {
                    watchingFolders[path + "/" + fileList[i]] = true;
                    continue;
                }
                setupWatchers(path + "/" + fileList[i]);
            }
        }
    }
}