- MooTools 1.2 Beginner's Guide
- Jacob Gube Garrick Cheung
- 341字
- 2021-04-01 13:33:35
Chapter 2. Writing JavaScript with MooTools
Using MooTools means you'll be coding in a web application framework that excels in object-oriented programming and JavaScript best practices. Modern development principles, such as unobtrusive JavaScript programming and object-based logic is the bread and butter of MooTools.
For example, modern development practices dictate that we separate our site's functional and behavioral layers (server-side and client-side scripts) from our site's content structural layer (HTML markup). This concept is known as unobtrusive JavaScript, and we'll delve into this best practice here in this chapter. You'll see one of the more important ways of how MooTools makes us write better JavaScript.
But we're going to be covering more than just unobtrusive JavaScript. We're going to work with classes, which is the design pattern of the entire MooTools framework.
MooTools is structured into classes. In programming, a class is simply a template of an object. A class can contain many methods or properties such as normal variables or even references to other classes and objects.
To understand how to write great MooTools code that adheres to best practices, you have to understand its fundamental structure and the concept of classes, which I must admit, can be confusing and hard to grok.
If you know another programming language, especially an object-oriented one, or a pseudo-object-oriented one like PHP (this is where I learned the concept of a class), then the stuff we'll discuss here will look very familiar to you. You can then compare and contrast the difference in syntax of classes in your particular language. As an example, for you PHP folks out there, in PHP 5, we have the
__construct()
function, which you'll soon see, is exactly like theinitialize
method of a MooTools class.
In this chapter we shall:
- Learn how MooTools helps us write unobtrusive JavaScript
- Work with classes by creating our own class
- See how MooTools works by exploring a couple of classes
- Learn about the concept of chainability by working through a simple animation example
So let's get on with it!
- 做好PPT就靠這幾招:圖解力+吸引力+說服力
- AutoCAD 2017實用教程
- Drools規則引擎技術指南
- Joomla! Social Networking with JomSocial
- 深入理解OpenCV:實用計算機視覺項目解析(原書第3版)
- 中文版Photoshop CS6經典自學教程
- 神奇的中文版Photoshop CC 2017入門書
- 中文版Photoshop CC基礎培訓教程
- iPad Procreate風格繪畫之美
- 剪映真傳:88招玩轉短視頻剪輯
- Origin 2022科學繪圖與數據分析(高級應用篇)
- Photoshop后期強:多重曝光專業技法寶典
- Science Teaching with Moodle 2.0
- Plone 3 Theming
- 中文版Corel DRAW X5案例實訓教材