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網頁應用程式設計
174
|
第十一章
目前 Spine 最大的問題,應該就是它的說明文件明顯不足。不過這套函式庫才問世不
久,相信再給它一些時間,說明文件不足的情況應該就會有改善。況且相信只要透過本
章的說明、以及範例程式碼的輔助,應該就足以讓你對這套函式庫有更深一層的了解。
安裝
Spine 的安裝方式很簡單,只要到 Spine 的專案儲存庫(
http://github.com/maccman/
spine
)下載函式庫檔案,再把它加進網頁裡就可以了。Spine 不需相依任何其他函式庫:
<script src="spine.js" type="text/javascript" charset="utf-8"></script>
Spine 函式庫裡的所有成員,都隸屬於相同的命名空間(也就是變數
Spine
),因此不
容易和其他變數發生衝突。即使將 Spine 搭配其他的函式庫(像是 jQuery Zepto,或
Prototype…等等)一起使用,也不用擔心會有變數衝突的狀況發生。
類別
差不多所有的 Spine 物件,都會被封裝在類別裡面。建立 Spine 類別的做法,是透過
Object.create()
和單純的原型繼承機制。這種建立類別的方式,有別於一般常用的做
法(更詳細的說明,可參閱本書第三章)。
建立新類別的方式,就是呼叫
Spine.Class.create([ 實體屬性 , 類別屬性 ])
,並傳入一
些實體屬性(非必傳)和類別屬性(非必傳):
var User = Spine.Class.create({
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