Skip to Content
JAVASCRIPT網頁應用程式設計
book

JAVASCRIPT網頁應用程式設計

by Alex MacCaw
January 2013
Intermediate to advanced
332 pages
5h 23m
Chinese
GoTop Information, Inc.
Content preview from JAVASCRIPT網頁應用程式設計
即時網頁(Real-time web
|
127
有趣的部分:開發網頁應用程式。對於用戶端而言,使用它就跟在網頁裡套用某個外部
JavaScript 檔案,並註冊頻道(subscribe to a channel)一樣簡單。如果需要發布訊息,
只需要發送 HTTP 請求至它們的 REST API
http://pusherapp.com/docs
)。
即時架構
透過前面的介紹,相信你現在應該已經非常清楚即時推送資料給用戶端的觀念,但究竟
該如何實際將它們整合進 JavaScript 應用程式裡面呢?如果你已經正確的為應用程式建
立好模型,那麼整合的工作其實非常簡單。本節接下來將會仔細說明,運用 PubSub
式開發即時網頁應用程式時,所需進行的所有步驟。首先是將資料的變動傳達給用戶端
的程序。
即時程式架構,是由事件驅動整個流程(event-driven)。一般是由使用者的操作來觸發
事件:某個使用者修改了某筆資料,觸發了某個事件,系統會傳遞該事件,進而將修改
過的資料推送給所有正在使用系統的使用者,並更新所有使用者手邊的資料。當你試圖
讓應用程式具備即時互動能力時,首先得思考兩件事:
哪些模型需要具備即時互動能力?
當這些模型的內容被更新時,需要通知哪些使用者?
有時當模型的內容被更新時,可能會需要通知所有正在使用系統的使用者。像是網頁的
資料只要一有更新,所有正在瀏覽網頁的使用者都該馬上看到相同的最新資訊。不過一
般最常見的情境是,如果某筆資料只和特定人士有關係,那麼當該資料的內容被更新 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

初めてのJavaScript 第3版 ―ES2015以降の最新ウェブ開発

初めてのJavaScript 第3版 ―ES2015以降の最新ウェブ開発

Ethan Brown, 武舎 広幸, 武舎 るみ
PHP编程:第4版

PHP编程:第4版

Kevin Tatroe, Peter MacIntyre
Strange Code

Strange Code

Ronald T. Kneusel
Perfecting Your Thinking Skills

Perfecting Your Thinking Skills

MIT Sloan Management Review

Publisher Resources

ISBN: 9789862766811