"use strict"; // P A C K A G E S import html from "choo/html"; import { require as local } from "app-root-path"; // V A R I A B L E S const config = local("/config"); let title = ""; // E X P O R T module.exports = exports = (state, emit) => { if (state.route !== "/" && state.params.wildcard) title = `${state.params.wildcard.capitalize()} ∙ LBRY ∙ ${config.meta.tagline}`; else if (state.route === "api") title = `API ∙ LBRY ∙ ${config.meta.tagline}`; else title = `LBRY ∙ ${config.meta.tagline}`; if (state.title !== title) emit(state.events.DOMTITLECHANGE, title); state.page = state.page || { }; // TODO: // - Support custom metadata (descriptions and whatnot) return html` ${title} `; }; // H E L P E R String.prototype.capitalize = function () { return this.charAt(0).toUpperCase() + this.slice(1); };