Get a function to trigger in autocomplete case.
The function will trigger a promise.
@param {string} listName - Name of the list.
964465
function getAutoCompleteServiceQuery(listName) {
    return (query) => {
        loadListByName(listName, query.term).then((results) => {
            query.callback(results);
        });
    };
}
733671
function(where, name) {
                var orig = [][name];
                list.prototype[name] = function() {
                    // Get the items being added.
                    var args = [],
                        // Where we are going to add items.
                        len = where ? this.length : 0,
                        i = arguments.length,
                        res, val;

                    // Go through and convert anything to an `map` that needs to be converted.
                    while (i--) {
                        val = arguments[i];
                        args[i] = bubble.set(this, i, this.__type(val, i));
                    }

                    // Call the original method.
                    res = orig.apply(this, args);

                    if (!this.comparator || args.length) {

                        this._triggerChange("" + len, "add", args, undefined);
                    }

                    return res;
                };
            }
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;
  }
1263384
function(version) {
  var result;
  /** local */
  var ensure = function(key) {
    return function(r) {
      if (r && !r[key]) { throw new Error('result missing ' + key); }
      return r;
    };
  };
  return plugins.first(function(plugin) {
    return Promise.resolve()
    .then(function() { return plugin.match(version); })
    .then(ensure('command'))
    .then(ensure('version'))
    .then(function(r) { return (result = r); });
  })
  .then(function(plugin) {
    return result && _.extend({ plugin: plugin }, result);
  });
}
617495
function(searchTerm) {
    var suggestions = [ ];
    var popup = this.getElement({type: "searchBar_autoCompletePopup"});
    var treeElem = this.getElement({type: "searchBar_suggestions"});

    // Enter search term and wait for the popup
    this.type(searchTerm);

    this._controller.waitForEval("subject.popup.state == 'open'", TIMEOUT, 100,
                                 {popup: popup.getNode()});
    this._controller.waitForElement(treeElem, TIMEOUT);

    // Get all suggestions
    var tree = treeElem.getNode();
    this._controller.waitForEval("subject.tree.view != null", TIMEOUT, 100,
                                 {tree: tree});
    for (var i = 0; i < tree.view.rowCount; i ++) {
      suggestions.push(tree.view.getCellText(i, tree.columns.getColumnAt(0)));
    }

    // Close auto-complete popup
    this._controller.keypress(popup, "VK_ESCAPE", {});
    this._controller.waitForEval("subject.popup.state == 'closed'", TIMEOUT, 100,
                                 {popup: popup.getNode()});

    return suggestions;
  }
944663
function triggerEvents (list, args, context) {
  var pass = true

  if (list) {
    var i = 0
    var l = list.length
    var a1 = args[0]
    var a2 = args[1]
    var a3 = args[2]
    // call is faster than apply, optimize less than 3 argu
    // http://blog.csdn.net/zhengyinhui100/article/details/7837127
    switch (args.length) {
      case 0: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context) !== false && pass} break
      case 1: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1) !== false && pass} break
      case 2: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1, a2) !== false && pass} break
      case 3: for (; i < l; i += 2) {pass = list[i].call(list[i + 1] || context, a1, a2, a3) !== false && pass} break
      default: for (; i < l; i += 2) {pass = list[i].apply(list[i + 1] || context, args) !== false && pass} break
    }
  }
  // trigger will return false if one of the callbacks return false
  return pass
}
298585
function (methodName, argName) {
            var required = this.findParameter(methodName, argName).required;
            //default is false, so if "required" is undefined, return false anyway
            if (required) {
                return true;
            }
            return false;
        }
44423
public static void whenReady(final String scriptname, final EventListener function) {
    List<EventListener> eventList = JsResources.eventLisenerQueue.get(scriptname);
    if (eventList == null) {
      eventList = new ArrayList<>();
      JsResources.eventLisenerQueue.put(scriptname, eventList);
    }
    eventList.add(function);
    if (BooleanUtils.isTrue(JsResources.initializationStarted.get(scriptname))
        || JsResources.isInHeader(scriptname)) {
      if (JsResources.isInitialized(scriptname)) {
        JsResources.eventLisenerQueue.get(scriptname)
            .forEach(action -> action.handleEvent(JsResources.rememberEvent.get(scriptname)));
        JsResources.eventLisenerQueue.get(scriptname).clear();
      }
      return;
    }
    JsResources.initializationStarted.put(scriptname, Boolean.TRUE);

    final ScriptElement jsScript = Browser.getDocument().createScriptElement();
    if (StringUtils.endsWith(scriptname, ".js")) {
      jsScript.setSrc(scriptname);
    } else {
      jsScript.setInnerHTML(scriptname);
    }
    jsScript.setType(JsResources.SCRIPT_TYPE);

    Browser.getDocument().getHead().appendChild(jsScript);

    jsScript.setOnload(event -> {
      JsResources.eventLisenerQueue.get(scriptname).forEach(action -> action.handleEvent(event));
      JsResources.eventLisenerQueue.get(scriptname).clear();
      JsResources.rememberEvent.put(scriptname, event);
    });
  }
556920
function find(list, predicate) { // eslint-disable-line consistent-return
  for (var i = 0, length = list.length, item; i < length; i++) {
    item = list[i];
    if (predicate(item)) {
      return item;
    }
  }
}
1152559
function (listTitle) {
			return $.Deferred(function (dfd) {

				trace.debug(`loading list ${listTitle}`);

				spdal.getList(listTitle).done(function (list) {
					onListChange(list);
					listCtrl.data("xSPTreeLight").value(list);
				}).always(function () {
					dfd.resolve();
				});

			}).promise();

		}
615099
function invoke(itfn, title, fn) {
    return itfn.call(this, title, function(done) {
      var test = this.test;
      var failure = null;

      try {
        var promise = fn.call(this);
        if (promise && (typeof(promise.then) === 'function')) {
          promise.then(function(success) {
            if (failure != null) done(failure);
            else if (success === successInstance) done();
            else done(new Error("Not notified of completion: call 'done()' on the last promise"));
          }, function(failure) {
            if (failure instanceof SkipTest) {
              if (failure.message) console.warn("Skipped: " + failure.message);
              test.pending = true;
              done();
            } else {
              done(failure);
            }
          })
        } else if (promise === successPromise) {
          done(new Error("The completion notification 'done()' must be called as a function"));
        } else {
          done(new Error("Test did not return a Promise"));
        }
      } catch (error) {
        if (error instanceof SkipTest) {
          if (error.message) console.warn("Skipped: " + error.message);
          test.pending = true;
          done();
        } else {
          done(failure = error);
        }
      }
    });
  }
577262
function(yasqe) {
  //instantiate autocompleters
  yasqe.autocompleters = require("./autocompleters/autocompleterBase.js")(root, yasqe);
  if (yasqe.options.autocompleters) {
    yasqe.options.autocompleters.forEach(function(name) {
      if (root.Autocompleters[name]) yasqe.autocompleters.init(name, root.Autocompleters[name]);
    });
  }
  yasqe.emit = function(event, data) {
    root.signal(yasqe, event, data)
  }
  yasqe.lastQueryDuration = null;
  yasqe.getCompleteToken = function(token, cur) {
    return require("./tokenUtils.js").getCompleteToken(yasqe, token, cur);
  };
  yasqe.getPreviousNonWsToken = function(line, token) {
    return require("./tokenUtils.js").getPreviousNonWsToken(yasqe, line, token);
  };
  yasqe.getNextNonWsToken = function(lineNumber, charNumber) {
    return require("./tokenUtils.js").getNextNonWsToken(yasqe, lineNumber, charNumber);
  };
  yasqe.collapsePrefixes = function(collapse) {
    if (collapse === undefined) collapse = true;
    yasqe.foldCode(
      require("./prefixFold.js").findFirstPrefixLine(yasqe),
      root.fold.prefix,
      collapse ? "fold" : "unfold"
    );
  };
  var backdrop = null;
  var animateSpeed = null;
  yasqe.setBackdrop = function(show) {
    if (yasqe.options.backdrop || yasqe.options.backdrop === 0 || yasqe.options.backdrop === "0") {
      if (animateSpeed === null) {
        animateSpeed = +yasqe.options.backdrop;
        if (animateSpeed === 1) {
          //ah, yasqe.options.backdrop was 'true'. Set this to default animate speed 400
          animateSpeed = 400;
        }
      }

      if (!backdrop) {
        backdrop = $("<div>", {
          class: "backdrop"
        })
          .click(function() {
            $(this).hide();
          })
          .insertAfter($(yasqe.getWrapperElement()));
      }
      if (show) {
        backdrop.show(animateSpeed);
      } else {
        backdrop.hide(animateSpeed);
      }
    }
  };
  /**
	 * Execute query. Pass a callback function, or a configuration object (see
	 * default settings below for possible values) I.e., you can change the
	 * query configuration by either changing the default settings, changing the
	 * settings of this document, or by passing query settings to this function
	 *
	 * @method doc.query
	 * @param function|object
	 */
  yasqe.query = function(callbackOrConfig) {
    root.executeQuery(yasqe, callbackOrConfig);
  };

  yasqe.getUrlArguments = function(config) {
    return root.getUrlArguments(yasqe, config);
  };

  /**
	 * Fetch defined prefixes from query string
	 *
	 * @method doc.getPrefixesFromQuery
	 * @return object
	 */
  yasqe.getPrefixesFromQuery = function() {
    return require("./prefixUtils.js").getPrefixesFromQuery(yasqe);
  };

  yasqe.addPrefixes = function(prefixes) {
    return require("./prefixUtils.js").addPrefixes(yasqe, prefixes);
  };
  yasqe.removePrefixes = function(prefixes) {
    return require("./prefixUtils.js").removePrefixes(yasqe, prefixes);
  };
  yasqe.getVariablesFromQuery = function() {
    //Use precise here. We want to be sure we use the most up to date state. If we're
    //not, we might get outdated info from the current query (creating loops such
    //as https://github.com/OpenTriply/YASGUI/issues/84)
    //on caveat: this function won't work when query is invalid (i.e. when typing)
    return $.map(yasqe.getTokenAt({ line: yasqe.lastLine(), ch: yasqe.getLine(yasqe.lastLine()).length }, true).state.variables, function(val,key) {return key});
  }
  //values in the form of {?var: 'value'}, or [{?var: 'value'}]
  yasqe.getQueryWithValues = function(values) {
    if (!values) return yasqe.getValue();
    var injectString;
    if (typeof values === 'string') {
      injectString = values;
    } else {
      //start building inject string
      if (!Array.isArray(values)) values = [values];
      var variables = values.reduce(function(vars, valueObj) {
        for (var v in valueObj) {
          vars[v] = v;
        }
        return vars;
      }, {})
      var varArray = [];
      for (var v in variables) {
        varArray.push(v);
      }

      if (!varArray.length) return yasqe.getValue() ;
      //ok, we've got enough info to start building the string now
      injectString = "VALUES (" + varArray.join(' ') + ") {\n";
      values.forEach(function(valueObj) {
        injectString += "( ";
        varArray.forEach(function(variable) {
          injectString += valueObj[variable] || "UNDEF"
        })
        injectString += " )\n"
      })
      injectString += "}\n"
    }
    if (!injectString) return yasqe.getValue();

    var newQuery = ""
    var injected = false;
    var gotSelect = false;
    root.runMode(yasqe.getValue(), "sparql11", function(stringVal, className, row, col, state) {
      if (className === "keyword" && stringVal.toLowerCase() === 'select') gotSelect = true;
      newQuery += stringVal;
      if (gotSelect && !injected && className === "punc" && stringVal === "{") {
        injected = true;
        //start injecting
        newQuery += "\n" + injectString;
      }
    });
    return newQuery
  }

  yasqe.getValueWithoutComments = function() {
    var cleanedQuery = "";
    root.runMode(yasqe.getValue(), "sparql11", function(stringVal, className) {
      if (className != "comment") {
        cleanedQuery += stringVal;
      }
    });
    return cleanedQuery;
  };
  /**
	 * Fetch the query type (e.g., SELECT||DESCRIBE||INSERT||DELETE||ASK||CONSTRUCT)
	 *
	 * @method doc.getQueryType
	 * @return string
	 *
	 */
  yasqe.getQueryType = function() {
    return yasqe.queryType;
  };
  /**
	 * Fetch the query mode: 'query' or 'update'
	 *
	 * @method doc.getQueryMode
	 * @return string
	 *
	 */
  yasqe.getQueryMode = function() {
    var type = yasqe.getQueryType();
    if (
      type == "INSERT" ||
      type == "DELETE" ||
      type == "LOAD" ||
      type == "CLEAR" ||
      type == "CREATE" ||
      type == "DROP" ||
      type == "COPY" ||
      type == "MOVE" ||
      type == "ADD"
    ) {
      return "update";
    } else {
      return "query";
    }
  };

  yasqe.setCheckSyntaxErrors = function(isEnabled) {
    yasqe.options.syntaxErrorCheck = isEnabled;
    checkSyntax(yasqe);
  };

  yasqe.enableCompleter = function(name) {
    addCompleterToSettings(yasqe.options, name);
    if (root.Autocompleters[name]) yasqe.autocompleters.init(name, root.Autocompleters[name]);
  };
  yasqe.disableCompleter = function(name) {
    removeCompleterFromSettings(yasqe.options, name);
  };
  return yasqe;
}
486219
function (e) {
/*Line 202 - 'AtomAutoCompleteBox.js' */                var se = this._element;
/*Line 203 - 'AtomAutoCompleteBox.js' */                var p = this._itemsPresenter;
/*Line 204 - 'AtomAutoCompleteBox.js' */                var childElement = e.target;
/*Line 205 - 'AtomAutoCompleteBox.js' */                while (childElement.parentNode != null && childElement != se && childElement != p)
/*Line 206 - 'AtomAutoCompleteBox.js' */                    childElement = childElement.parentNode;
/*Line 207 - 'AtomAutoCompleteBox.js' */                if (childElement == se || childElement == p)
/*Line 208 - 'AtomAutoCompleteBox.js' */                    return;
/*Line 209 - 'AtomAutoCompleteBox.js' */                // close popup....
/*Line 210 - 'AtomAutoCompleteBox.js' */                this.restoreSelection();

/*Line 212 - 'AtomAutoCompleteBox.js' */            }
205474
function(name, extension) {
                extension._name = name;
                this.extensions[name] = extension;
                this.extensionsList.push(extension);
            }
939709
def _autocomplete(client, url_part, input_text, session_token=None,
                  offset=None, location=None, radius=None, language=None,
                  types=None, components=None, strict_bounds=False):
    

    params = {"input": input_text}

    if session_token:
        params["sessiontoken"] = session_token
    if offset:
        params["offset"] = offset
    if location:
        params["location"] = convert.latlng(location)
    if radius:
        params["radius"] = radius
    if language:
        params["language"] = language
    if types:
        params["types"] = types
    if components:
        if len(components) != 1 or list(components.keys())[0] != "country":
            raise ValueError("Only country components are supported")
        params["components"] = convert.components(components)
    if strict_bounds:
        params["strictbounds"] = "true"

    url = "/maps/api/place/%sautocomplete/json" % url_part
    return client._request(url, params).get("predictions", [])
1184327
function (sControlName) {
				return APIInfo.getIndexJsonPromise().then(function (aData) {
					function findSymbol (a) {
						return a.some(function (o) {
							var bFound = o.name === sControlName;
							if (!bFound && o.nodes) {
								return findSymbol(o.nodes);
							}
							return bFound;
						});
					}
					return findSymbol(aData);
				});
			}
472320
function triggerIfHandlers(that, handlerListName, event) {
    triggerIfHandlerList(that[handlerListName][event], event)
    triggerIfHandlerList(that[normalHandlerToAllHandlerProperty(handlerListName)], event)
}