插件
其中,Ale.use
函数需要一个参数,来指定要加载的 Ale 插件对象。例如我们传入一个名为 test
的 Ale 插件对象:
test
其实就是一个变量。在下面的章节中,我们将会学习如何制作一个 Ale 插件对象。
如果要想让 test
成为一个 Ale 插件对象,那么它至少要具备 name
和 install
属性:
你可以在 属性里给 Ale 对象的 prototype
属性添加函数或属性…
我们已经定义了一个名为 test
的 Ale 插件对象,现在让我们在控制台中输入 Ale.use(test)
来安装它吧!(安装时会输出 Hello! )