TGStat
TGStat
Type to search
Advanced channel search
  • flag English
    Site language
    flag Russian flag English flag Uzbek
  • Sign In
  • Catalog
    Channels and groups catalog Regional compilations Thematic compilations Платные каналы Search for channels
    Add a channel/group
  • Ratings
    Rating of channels Rating of groups Posts rating
    Ratings of brands and people
  • Analytics
  • Search by posts
  • Telegram monitoring
  • Promotion
    Advertising through Yandex Business Advertising in channels through TGStat Agency Advertising on TGStat.ru website
Заметки разработчика

13 Apr, 06:29

Open in Telegram Share Report

JSON в браузере: import или fetch — руководство по выбору

Спойлер: import из JSON — это не замена fetch()

Кажется, что новый синтаксис import data from './file.json' with { type: 'json' } проще и современнее. Но у него есть три жёстких ограничения:

🔹 Пожизненное кеширование — данные останутся в памяти на всю сессию
🔹 Нет отмены запроса — AbortController не подключается
🔹 Минимум информации об ошибках — не поймёшь, 404 это или CORS

В статье сравнили оба подхода по безопасности, кешу, стримингу и контролю. В конце — готовый чек-лист: когда брать import, а когда только fetch с проверкой Content-Type.

🖥 Читать статью

📱 @dev_notes_ru

#JavaScript #JSON #import #fetch

223 0 0 1 5
Catalog
Channels and groups catalog Channels compilations Search for channels Add a channel/group
Ratings
Rating of Telegram channels Rating of Telegram groups Posts rating Ratings of brands and people
API
API statistics Search API of posts API Callback
Our channels
@TGStat @TGStat_Chat @telepulse @TGStatAPI
Read
Академия TGStat Telegram Research 2019 Telegram Research 2021 Telegram Research 2023
Contacts
Справочный центр Support Email Jobs
Miscellaneous
Terms and conditions Privacy policy Public offer
Our bots
@TGStat_Bot @SearcheeBot @TGAlertsBot @tg_analytics_bot @TGStatChatBot