Files
zulip/static/js/search_pill_widget.js
Steve Howell 746cc9e1f6 refactor: Extract browser_history module.
This mainly extracts a new module called
browser_history. It has much fewer dependencies
than hashchange.js, so any modules that just
need the smaller API from browser_history now
have fewer transitive dependencies.

Here are some details:
    * Move is_overlay_hash to hash_util.
    * Rename hashchange.update_browser_history to
      brower_history.update
    * Move go_to_location verbatim.
    * Remove unused argument for exit_overlay.
    * Introduce helper functions:
        * old_hash()
        * set_hash_before_overlay()
        * save_old_hash()

We now have 100% line coverage on the extracted
code.
2021-03-22 13:29:32 -07:00

23 lines
525 B
JavaScript

import $ from "jquery";
import * as browser_history from "./browser_history";
import * as search_pill from "./search_pill";
export let widget;
export function initialize() {
if (!page_params.search_pills_enabled) {
return;
}
const container = $("#search_arrows");
widget = search_pill.create_pills(container);
widget.onPillRemove(() => {
if (widget.items().length === 0) {
browser_history.go_to_location("");
}
});
widget.createPillonPaste(() => false);
}