javascript AOP
2024-10-12 07:37:45
Function.prototype.bind = function(b) {
var a = this;
return function() {
a.apply(b, arguments)
}
};
Function.prototype.once = function() {
var b = false,
a = this;
return function() {
if (b) {
return
} else {
b = true;
a.apply(this, arguments)
}
}
};
Function.prototype.before = function(b) {
var a = this;
return function() {
if (b.apply(this, arguments) == false) {
return false
}
return a.apply(this, arguments)
}
};
Function.prototype.after = function(b) {
var a = this;
return function() {
var c = a.apply(this, arguments);
if (c === false) {
return false
}
b.apply(this, arguments);
return c
}
};
String.prototype.hasString = function(f) {
if (typeof f == "object") {
for (var d = 0, g = f.length; d < g; d++) {
if (!this.hasString(f[d])) {
return false
}
}
return true
} else {
if (this.indexOf(f) != -1) {
return true
}
}
};
最新文章
- 天气预报API开发
- ThinkPHP3.1快速入门(1)基础
- socket关联查询
- SVN强制解锁操作
- CentOS-6.5安装zabbix2.4.4
- Ubuntu下解决bash 没有那个文件或目录的方法
- Maven Build profiles
- mysql.server 文件修改起动多实例
- springMVC导出 CSV案例
- javascript 一个关于时间排序的算法(一个页面多个倒计时排序)
- soap 路由
- TDBGrideh表头自动排序设置
- [转] Java中ArrayList类的用法
- Cortex-M3学习日志(二)-- 按键实验
- UVA 839 (13.08.20)
- Mysql对自增主键ID进行重新排序
- c++ 计算程序运行时间
- vb6 控件未注册问题解决
- Guava 教程1-使用 Google Collections,Guava,static imports 编写漂亮代码
- C# System.IO.FileMode