Event Loop для начинающих. Не так страшно, как вам рассказывали

JavaScript выполняет код в одном основном потоке. Это означает, что инструкции выполняются последовательно — одна за другой. Получил команду — выполнил. Но что делать интерпретатору, если он встречает код, который не может выполнить сразу? Например, обработчик события. Пока событие, допустим, клик на кнопку, не произошло, код внутри обработчика не выполнится. Такой код называют асинхронным. К асинхронным операциям относятся, например, таймеры ( setTimeout ), сетевые запросы или события интерфейса. Промисы ( Promise ) используются для обработки результатов таких операций. В такой ситуации на помощь интерпретатору JS приходит среда, в которой выполняется скрипт. Это может быть Node.js, мобильные среды или интерфейс, который предоставляет браузер — Web API (есть и другие). В отличие от JavaScript-движка, среда выполнения может использовать несколько потоков для обработки ввода-вывода, таймеров и сетевых операций. Если сравнить выполнение скрипта с выступлением оркестра, то дирижёром, который отвечает, чтобы каждая функция «отыграла свою партию» в нужный момент, можно назвать Event Loop. Event Loop — это механизм среды выполнения, который управляет порядком выполнения задач. Он координирует работу JavaScript-кода, обработку событий и другие процессы браузера. Вопреки расхожему мнению, работа этого механизма не так сложна, как его часто описывают. В этой статье, проповедуя Фреймановскую истину — «Если не можешь объяснить что-то простыми словами, то ты не понимаешь этого» — автор попытается (для себя и для других) описать работу Event Loop в браузере. В среде Node.js концепция похожа, но вместо Web API используются другие механизмы ввода-вывода.

https://habr.com/ru/articles/1011258/

#eventloop #webapi #новичкам

Event Loop для начинающих. Не так страшно, как вам рассказывали

JavaScript выполняет код в одном основном потоке. Это означает, что инструкции выполняются последовательно — одна за другой. Получил команду — выполнил. Но что делать интерпретатору, если он встречает...

Хабр

Holy shit weather.gov's api is relatively easy to use. Just `curl https://api.weather.gov/gridpoints/SGF/109,49/forecast`
(Although to get this URL you have to first curl https://api.weather.gov/points/$LAT,$LON where $LAT and $LON are your latitude and longitude)

#weather #webapi #NOAA #fuckdoge (seriously, this what I want my government to spent money on! I'm still salty)

«Firefox 148 führt Sanitizer-API ein – neuer Standard gegen XSS-Angriffe:
Mit Firefox 148 hält eine lang erwartete Web-API Einzug in den Browser-Alltag - Die Sanitizer-API standardisiert die Bereinigung von HTML-Code direkt beim Einfügen ins DOM und soll Webentwicklern den Schutz vor Cross-Site-Scripting deutlich erleichtern»

XSS ist immer noch ein aktuelles Thema, das mMn von den meisten WebDev's nicht wirklich wahr genommen wird.

🦊 https://www.all-about-security.de/firefox-148-fuehrt-sanitizer-api-ein-neuer-standard-gegen-xss-angriffe/

#xss #firefox #webdev #webapi #web

Firefox 148 führt Sanitizer-API ein – neuer Standard gegen XSS-Angriffe

Firefox 148 bringt die standardisierte Sanitizer-API mit setHTML() – ein einfacher Schutz gegen XSS-Lücken für Webentwickler.

All About Security Das Online-Magazin zu Cybersecurity (Cybersicherheit). Ransomware, Phishing, IT-Sicherheit, Netzwerksicherheit, KI, Threats, DDoS, Identity & Access, Plattformsicherheit

Local-Only File Encryption with JavaScript.

I've been exploring the #WebCryptoAPI and I'm impressed!

When combined with the #FileSystemAPI, it offers a seemingly secure way to #encrypt and #store files directly on your device. Think #localstorage, but with #encryption!

I know #webapps can have #security vulnerabilities since the code is served over the web, so I've #OpenSourced my demo! You can check it out, and it should even work if #selfhosted on #GitHubPages.

Live Demo: https://dim.positive-intentions.com/?path=/story/usefs--encrypted-demo

Demo Code: https://github.com/positive-intentions/dim/blob/staging/src/stories/05-Hooks-useFS.stories.js

About the Dim framework:
https://positive-intentions.com/docs/category/dim

IMPORTANT NOTES (PLEASE READ!):
* This is NOT a product. It's for #testing and #demonstration purposes only.
* It has NOT been reviewed or audited. Do NOT use for sensitive data.
* The password encryption currently uses a hardcoded password. This is for demonstration, not security.
* This is NOT meant to replace robust solutions like #VeraCrypt. It's just a #proofofconcept to show what's possible with #browser #APIs.

#Encryption #Cryptography #JavaScript #Frontend #Privacy #Security #WebDevelopment #Coding #Developer #Tech #FOSS #OpenSource #GitHub #MastodonDev #Programming #WebStandards #FileSystem #WebAPI #ProofOfConcept

@storybook/core - Storybook

Mostly I've always used middleware to apply broad swaths of business logic to my ASP.NET Core operations, but found a nice use case for ActionFilterAttributes if you need to selectively implement business logic to specific controller items (https://learn.microsoft.com/en-us/aspnet/mvc/overview/older-versions/hands-on-labs/aspnet-mvc-4-custom-action-filters). However, they don't document how to do dependency injection on your filters well, here is the best practice I've found so far: https://edi.wang/post/2019/1/21/aspnet-core-dependency-injection-in-actionfilterattribute

#Dotnet #ASPCore #WebAPI

ASP.NET MVC 4 Custom Action Filters

ASP.NET MVC provides Action Filters for executing filtering logic either before or after an action method is called. Action Filters are custom attributes tha...

[브라우저 API가 모두 ‘웹’ API는 아님

웹 플랫폼의 표준화된 API가 표면적으로는 동일하지만, 실제로는 브라우저 벤더별로 구현이 크게 달라져 이식성, 프라이버시, 표준화의 불균형 등의 문제가 발생하고 있음을 분석한 기사입니다. 개발자는 이러한 벤더 종속성을 인식하고, 테스트, 문서화, 대체 경로 마련 등을 통해 대응해야 합니다.

https://news.hada.io/topic?id=25974

#webapi #browsercompatibility #privacy #webstandards #developertools

브라우저 API가 모두 ‘웹’ API는 아님

<ul> <li>웹 플랫폼은 <strong>표준화된 API</strong> 위에서 동일하게 동작한다는 인식이 널리 퍼져 있으나, 실제로는 <strong>브라우저 벤더별 ...

GeekNews

Telerik software engineer Dave Brock takes a look at improvements in .NET 10 from a web api coder's perspective. Reviewed improvements include:

1. Built in Validation for Minimal APIs
2. Validation Error Responses
3. OpenAPI 3.1
4. Schema Improvements
5. EF Core 10 Named Query Filters
6. C# 14 Improvements
7. Null-conditional Assignments
8. Extension Members
(...)

"What’s New with APIs in .NET 10: Taking a Look at Real Improvements"

https://www.telerik.com/blogs/whats-new-apis-net-10-real-improvements

#programming #dotnet #webapi

I found this an interesting approach to HTTP clients for Python: https://paulwrites.software/articles/python-api-clients

#Python #HTTP #WebDev #WebAPI #HTTPAPI

A different way to think about Python API Clients - Paul writes software

⭐️ A beta release of this tool is now available to download and use I've spent a lot of my free time in the past few months working on Clientele, which is a project I started way back in 2023. I've a…

Paul writes software
🚀 Oh wow, Obelisk 0.32 is here, bringing the groundbreaking ability to *cancel* things — enjoy the thrill of giving up midway! 🤯 Now with #WebAPI for those who can't decide on a format, and #Postgres support so your failures can be highly available across multiple nodes. 🎉 Who knew making things fall apart could be so innovative?
https://obeli.sk/blog/announcing-obelisk-0-32/ #Obelisk032 #CancelCulture #Innovation #HackerNews #ngated
Obelisk 0.32: Cancellation, WebAPI, Postgres - Blog

Obelisk 0.32: Cancellation, WebAPI, Postgres - Blog