Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Ilya Kantor

Rating No ratings yet

No description

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
# The Modern JavaScript Tutorial - Part III: Additional Articles ## 【One-Line Pitch】 A deep-dive reference for intermediate JavaScript developers covering browser APIs, binary data handling, network communication, and real-time features—essential reading if you've mastered the basics and need practical knowledge for building production web applications. ## 【Book Arc】 - **Opening (~0%–10%)**: Browser window management and security fundamentals—popup windows, the Same Origin Policy, iframe access restrictions, and cross-window communication patterns. - **Early (~10%–25%)**: Binary data handling with ArrayBuffer, TypedArrays, TextEncoder/Decoder, and Blob objects, plus the Fetch API basics for making HTTP requests. - **Early (~25%–35%)**: Advanced Fetch capabilities including FormData for file uploads, download progress tracking, cross-origin request mechanics, and URL/URLSearchParams for proper URL handling. - **Middle (~35%–50%)**: XMLHttpRequest for upload progress and resumable uploads, long polling for server communication, and WebSocket for persistent bidirectional connections. - **Late (~50%–75%)**: Cookies in depth—reading, writing, security attributes, and practical manipulation patterns for session management and user tracking. - **Ending (~75%–100%)**: Additional browser APIs and advanced patterns (excerpts cover through cookies; later chapters presumably address remaining topics like animations and regex). ## 【Key Takeaways】 - **Same Origin Policy governs all cross-window access** (Opening): A window from another origin blocks access to its document, variables, and even reading its location—only writing location (redirecting) is permitted. This is the foundation of browser security. - **TypedArrays provide structured binary views** (Early): Uint8Array, Int16Array, Float64Array, etc., are views over a shared ArrayBuffer, not standalone arrays. You can create multiple views over the same buffer without copying data, enabling efficient binary manipulation. - **TextEncoder/TextDecoder handle UTF-8 conversion** (Early): TextEncoder only supports UTF-8 and converts strings to Uint8Array; TextDecoder reverses the process. Use subarray views to decode specific portions of binary data. - **Blob represents binary data with MIME type** (Early): Higher-level than ArrayBuffer, Blob integrates with canvas operations (via toBlob), file downloads, and Fetch requests. Canvas transformations can be exported directly as Blobs. - **Fetch API covers modern HTTP needs** (Early): response.text(), .json(), .blob(), and .arrayBuffer() handle different response types. The keepalive option enables background requests during page unload (limited to 64kb body). - **FormData simplifies file uploads** (Early): Create from HTML forms or build programmatically; append(name, blob, filename) handles file fields. The set() method replaces existing fields while append() adds duplicates. - **WebSocket enables real-time bidirectional communication** (Middle): Persistent connection with packet-based data exchange, ideal for chat, games, and trading systems. Use bufferedAmount to check transmission status and close() with codes for graceful shutdown. - **Cookies are accessor properties, not simple data** (Late): document.cookie reads all cookies as a semicolon-delimited string; writing updates only specified cookies. Security attributes like SameSite prevent clickjacking attacks. ## 【Reading Tips】 - **Skim the popup window section** (~0%–5%): The window.open API is rarely needed in modern development, but the Same Origin Policy discussion is essential—read that part carefully. - **Deep-read the binary data chapters** (~10%–20%): TypedArrays and Blob are foundational for file handling, canvas operations, and WebSocket binary protocols. Work through the code examples actively. - **Focus on Fetch options and FormData** (~20%–30%): These are the most practical skills for daily development. The full Fetch options list is worth bookmarking for reference. - **Pay special attention to WebSocket** (~42%–48%): Real-time features are increasingly important. The connection lifecycle, bufferedAmount checking, and close codes are production-critical knowledge. - **The cookie chapter is reference material** (~48%–55%): Read for understanding of security implications, then return when you need specific manipulation patterns. ## 【Coverage Limits】 This guide covers the first half of Part III (through cookies). The excerpts do not cover later chapters on regular expressions, animations, or other additional articles that appear later in the book. ##
Excerpt 1
(another port: 8080 ) The “Same Origin” policy states that: ● if we have a reference to another window, e.g. a popup created by window.open or a window insid...
View in text
Excerpt 2
nload it let link = document.createElement('a'); link.download = 'example.png'; link.href = URL.createObjectURL(blob); link.click(); // delete the internal b...
View in text
Excerpt 3
le the server response if the request is made in onunload , because the document is already unloaded at that time, functions won’t work. ● Usually, the serve...
View in text
Excerpt 4
// the other party socket.onclose = event => { // event.code === 1000 // event.reason === "Work complete" // event.wasClean === true (clean close) Most commo...
View in text
Excerpt 5
pgrade functions: from 1 to 2, from 2 to 3, from 3 to 4 etc. Then, in upgradeneeded we can compare versions (e.g. old 2, now 4) and run per-version upgrades...
View in text
Excerpt 6
dEventListener('transitionend', function() { times++; go(); The event object for transitionend has few specific properties: event.propertyName The property t...
View in text
Excerpt 7
an> </slot> <ul> <slot name="item"> <li slot="item">Lollipop</li> <li slot="item">Fruit Toast</li> <li slot="item">Cup Cake</li> </slot> </ul> </div> </custo...
View in text
Excerpt 8
is to find non-digits \D and remove them from the string: let str = "+7(903)-123-45-67"; alert( str.replace(/\D/g, "") ); // 79031234567 A dot is “any charac...
View in text
Tags
AI categories
JavaScriptWeb TechnologyBackend
Publish Year: 2018
Language: English
Pages: 333
File Format: PDF
File Size: 3.5 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…