Skip to content

Instantly share code, notes, and snippets.

@chinghanho
Last active August 21, 2017 06:02
Show Gist options
  • Save chinghanho/c760a16e8243a25367c928a5a5fe3a85 to your computer and use it in GitHub Desktop.
Save chinghanho/c760a16e8243a25367c928a5a5fe3a85 to your computer and use it in GitHub Desktop.
// CommonJS 給你兩個工具:
//
// 1. require 函式
// 2. module 物件
//
// 可以用 module.exports 把物件模組化,用 reuqire 把物件載入。
function Animation() {
//
}
Animation.prototype.move = function () {}
module.exports = Animation
var Animation = require('./animation')
var anime = new Animation()
anime.move()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment