/
githubmirror
/
amphtml
Обзор
Документация
Войти
/
githubmirror
/
amphtml
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
extensions/amp-analytics/0.1/cookie-reader.js
34 строки
878 B
Jake Fried
♻️ amp lint --fix: sort/order (#37353)
12 янв 2022, 22:24
Не верифицирован
12 янв 2022, 22:24
8c34f2d
Код
Авторство
О чём код?
import {getCookie} from '../../../src/cookies'; import {isInFie} from '../../../src/iframe-helper'; import {getMode} from '../../../src/mode'; import {isProxyOrigin} from '../../../src/url'; /** * COOKIE macro resolver * @param {!Window} win * @param {!Element} element * @param {string} name * @return {?string} */ export function cookieReader(win, element, name) { if (!isCookieAllowed(win, element)) { return null; } return getCookie(win, name); } /** * Determine if cookie writing/reading feature is supported in current * environment. * Disable cookie writer in friendly iframe and proxy origin and inabox. * @param {!Window} win * @param {!Element} element * @return {boolean} */ export function isCookieAllowed(win, element) { return ( !isInFie(element) && !isProxyOrigin(win.location) && !(getMode(win).runtime == 'inabox') ); }