Skip to content

Commit

Permalink
Merge branch 'master' of github.com:seznam/CVUT
Browse files Browse the repository at this point in the history
  • Loading branch information
ondras committed Mar 21, 2024
2 parents d895b30 + 1a7ef21 commit e3594cb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions KAJ/cviceni/05/reseni.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h2>Chat</h2>
HTTP API with JSON response of Users characters
https://jsonplaceholder.typicode.com/users
WebSocket API with text messages
wss://zwa-chat.deno.dev
wss://kaj-chat.deno.dev
Main tasks
1. Use XMLHttpRequest to create HTTP request and get data from API
Expand Down Expand Up @@ -128,7 +128,7 @@ <h2>Chat</h2>
//

const textarea = document.querySelector("#chat");
const ws = new WebSocket("wss://zwa-chat.deno.dev");
const ws = new WebSocket("wss://kaj-chat.deno.dev");

ws.addEventListener("open", e => {
textarea.value += "[connected to chat]\n";
Expand Down
2 changes: 1 addition & 1 deletion KAJ/cviceni/05/zadani.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h2>Chat</h2>
HTTP API with JSON response of Users characters
https://jsonplaceholder.typicode.com/users
WebSocket API with text messages
wss://zwa-chat.deno.dev
wss://kaj-chat.deno.dev
Main tasks
1. Use XMLHttpRequest to create HTTP request and get data from API
Expand Down
4 changes: 2 additions & 2 deletions KAJ/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ <h2>Přednášky</h2>
<li><a href="prednasky/02/">JavaScript pro starší a pokročilé</a></li>
<li><a href="prednasky/03/">ES 2015+, historie a transpilace</a></li>
<li><a href="prednasky/04/">Události a asynchronní zpracování</a></li>
<!--
<li><a href="prednasky/05/">Ajax, XHR, fetch, HTTP a jejich kamarádi</a></li>
<!--
<li><a href="prednasky/06/">CSS3 &ndash; selektorový jazyk, generovaný obsah, media queries</a></li>
<li><a href="prednasky/07/">Transformace, Flexible Boxes, Grid</a></li>
<li><a href="prednasky/08/">Transitions, animations a efekty, Custom Properties</a></li>
Expand All @@ -110,8 +110,8 @@ <h2>Cvičení</h2>
<li><a href="cviceni/02/">Prototypy, this, třídy</a></li>
<li><a href="cviceni/03/">ES 2015+, Babel</a></li>
<li><a href="cviceni/04/">Události a asynchronní zpracování</a></li>
<!--
<li><a href="cviceni/05/">Ajax, XHR, HTTP, Fetch a WebSockety</a></li>
<!--
<li><a href="cviceni/06/">CSS3 &ndash; selektorový jazyk, media queries, fonty</a></li>
<li><a href="cviceni/07/">Flexbox layout, Grid layout</a></li>
Expand Down
15 changes: 8 additions & 7 deletions KAJ/prednasky/05/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
# XMLHttpRequest API

```js
let xhr = new XMLHttpRequest();
let xhr = new XMLHttpRequest()

xhr.addEventListener("readystatechange", /* ... */);
xhr.addEventListener("load", /* ... */);
xhr.addEventListener("readystatechange", /* ... */)
xhr.addEventListener("load", /* ... */)

xhr.open(metoda, url, async);
xhr.send(data);
xhr.open(metoda, url, async)
xhr.send(data)
```

---
Expand Down Expand Up @@ -194,6 +194,7 @@ response.arrayBuffer() // Promise

- Chybí `abort()` &rArr; lze vyřešit pomocí `new AbortController().signal`
- Chybí `timeout` &rArr; lze vyřešit pomocí `AbortSignal.timeout()`
- Sledování průběhu **nahrávání:** fetch nemá, nelze

---

Expand Down Expand Up @@ -391,7 +392,7 @@ mojeFunkce({name: "jan", data: [3, 4, true]})

# GraphQL

- Introspekce! Viz např. https://graphql.org/swapi-graphql
- Introspekce! Viz např. https://studio.apollographql.com/public/star-wars-swapi/variant/current/home
- Dotazy jsou často velké &rArr; jakou volit HTTP metodu?
- Dotazy možno parametrizovat:

Expand Down Expand Up @@ -430,7 +431,7 @@ mojeFunkce({name: "jan", data: [3, 4, true]})
- Notifikace ze strany serveru
- Persistentní spojení
- Léta draftů
- [Just Spaceships](https://ondras.zarovi.cz/games/just-spaceships/)
- [Just Spaceships](https://smaug.cz/just-spaceships/)
- [Railroad Ink](https://ondras.github.io/rri/)

---
Expand Down

0 comments on commit e3594cb

Please sign in to comment.