MCPcopy
hub / github.com/philc/vimium / activate

Function activate

pages/vomnibar_page.js:24–51  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

22}
23
24export async function activate(options) {
25 Utils.assertType(VomnibarShowOptions, options || {});
26 await Settings.onLoaded();
27 userSearchEngines.set(Settings.get("searchEngines"));
28
29 const defaults = {
30 completer: "omni",
31 query: "",
32 newTab: false,
33 selectFirst: false,
34 keyword: null,
35 };
36
37 options = Object.assign(defaults, options);
38
39 if (ui == null) {
40 ui = new VomnibarUI();
41 }
42 ui.setCompleterName(options.completer);
43 ui.refreshCompletions();
44 ui.setInitialSelectionValue(options.selectFirst ? 0 : -1);
45 ui.setForceNewTab(options.newTab);
46 ui.setQuery(options.query);
47 ui.setActiveUserSearchEngine(userSearchEngines.keywordToEngine[options.keyword]);
48 // Use await here for vomnibar_test.js, so that this page doesn't get unloaded while a test is
49 // running.
50 await ui.update();
51}
52
53class VomnibarUI {
54 constructor() {

Callers 1

initFunction · 0.70

Calls 9

setMethod · 0.80
getMethod · 0.80
setCompleterNameMethod · 0.80
refreshCompletionsMethod · 0.80
setForceNewTabMethod · 0.80
setQueryMethod · 0.80
updateMethod · 0.80

Tested by

no test coverage detected