/
githubmirror
/
amphtml
Обзор
Документация
Войти
/
githubmirror
/
amphtml
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
extensions/amp-date-countdown/1.0/web-component.js
32 строки
833 B
Keshav Varadachari
support --bento_only option in unit tests (#37935)
23 мар 2022, 22:14
Не верифицирован
23 мар 2022, 22:14
8614666
Код
Авторство
О чём код?
import mustache from '#bento/components/bento-mustache/1.0/bento-mustache'; import {getTemplate} from '#bento/util/template'; import {defineBentoElement} from '#preact/bento-ce'; import {BaseElement, TAG} from './base-element'; export class BentoDateCountdown extends BaseElement { /** @override */ checkPropsPostMutations() { const template = getTemplate(this.element); if (!template) { // show error? return; } this.mutateProps({ 'render': (data) => { const html = mustache.render(template./*OK*/ innerHTML, data); return {'__html': html}; }, }); } } /** * Registers `<bento-date-countdown>` component to CustomElements registry * @param {typeof globalThis=} win */ export function defineElement(win) { defineBentoElement(TAG, BentoDateCountdown, win); }