博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mootools_使用MooTools的别名功能
阅读量:2518 次
发布时间:2019-05-11

本文共 1339 字,大约阅读时间需要 4 分钟。

mootools

Not having internet at home for a month gave me a great opportunity to really study the MooTools core JavaScript file. One fun part of the library is its alias() functionality. Alias allows you to do exactly what the word means -- alias one functionality by calling it something else. For example, one usage of alias in the library is:

一个月没有在家上网,这给了我一个很好的机会来真正研究MooTools核心JavaScript文件。 库的一个有趣的部分是其alias()功能。 别名使您可以确切地实现该词的含义-通过调用其他功能来别名一种功能。 例如,库中别名的一种用法是:

Hash.alias('forEach', 'each');	//Hash iterationArray.alias('forEach', 'each');	//Array iteration

Using "each" is shorter and faster to type than "forEach." With aliasing in mind, I thought of a few fun usages of MooTools' alias. All of the following are aliases for the Element.dispose() functionality:

使用“ each”比“ forEach”更短,更快地键入。 考虑到别名,我想到了MooTools别名的一些有趣用法。 以下所有都是Element.dispose()功能的别名:

/* prison house */	Element.alias('dispose', 'shank');	$('prisoner').shank();		/* animals */	Element.alias('dispose', 'beach');	$('whale').beach();		/* automobiles */	Element.alias('dispose', 'compound');	$('car').compound();		/* mafia */	Element.alias('dispose', 'concreteShoes');	$('wiseguy').concreteShoes();

In all seriousness, I recommend using alias when you want to refer to a specific functionality by giving it your own name.

认真地说,当您要通过给自己命名的方式引用特定功能时,建议使用别名。

翻译自:

mootools

转载地址:http://ycpwd.baihongyu.com/

你可能感兴趣的文章
Java--面试通关要点
查看>>
iOS 消息推送原理
查看>>
随笔1
查看>>
Codeforces 731 C.Socks-并查集+STL(vector+map)
查看>>
洛谷 P3383 【模板】线性筛素数-线性筛素数(欧拉筛素数)O(n)基础题贴个板子备忘...
查看>>
C语言中的正负数及其输出以及小数
查看>>
Android Fragments 详细使用
查看>>
【转】MySQL-Utilities,mysql工具包
查看>>
使用echarts实现了一个折现图,数据是一天24小时
查看>>
杂项:game_navigation
查看>>
建站手册-职业规划:职业资源
查看>>
基于 Generator 和 Iterator 的惰性列表
查看>>
身为前端开发工程师,你需要了解的搜索引擎优化SEO.
查看>>
一篇文章掌握nightwatch自动化测试
查看>>
vue 上传图片到阿里云(前端直传:不推荐)
查看>>
求最大区间,使得特定的两个数的个数相等
查看>>
node读写Excel操作
查看>>
双飞翼布局
查看>>
android利用wireshark抓包
查看>>
Mac和Windows系统下Mysql数据库的导入导出
查看>>