@t7/utils
Version:
Utility methods for T7 components.
38 lines (27 loc) • 770 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/*
This method sets the page `title`
with `data-suffix`, if it exists.
*/
var title = function title() {
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
// Get document.
var d = document; // Get `title` tag.
var t = d.querySelector('title'); // Set in conditional.
var suffix = ''; // Get suffix.
if (t) {
suffix = t.getAttribute('data-suffix');
} // Title and suffix?
if (str && suffix) {
str = [str, suffix].join(' | '); // If no title exists.
} else if (!str) {
str = suffix;
} // Set title.
d.title = str;
}; // Expose function.
var _default = title;
exports.default = _default;
;