Namespace: hui

hui

hui是一个简单易用的前端H5框架
Since:
  • 2015-06-25 10:48
Author:
  • haiyang5210
Source:

Classes

Control
EventDispatcher
Flow

Namespaces

Control

Members

(static) startDebug

Properties:
Name Type Description
hui.startDebug Boolean 通过检测地址栏中startDebug=true参数确定是否开启调试模式
Source:

Methods

(static) define(name, deps, fun, forceopt, asycopt)

定义模块,规则同CMD
Parameters:
Name Type Attributes Description
name String 模块名称
deps Array 依赖的模块
fun function 模块构造器
force String <optional>
'force': 强制覆盖, '': 否 (默认)
asyc String <optional>
'syc': 立即加载依赖, '': 否 (默认)
Source:
Example
hui.define('hy_mod01', ['ext_md5'], function () {
console.log('This is hy_mod01.');
});

(static) extends(child, parent)

对象扩展(伪继承)
Parameters:
Name Type Description
child Object 子对象
parent Object 父对象
Source:
Example
var a = {a: 123};
var b = {b: 456};
var c = hui.extends({}, a, b);
console.log(c);
>> {a: 123, b: 456}
var d = {a: 789};
var c = hui.extends({}, a, b, d);
console.log(c);
>> {a: 789, b: 456}

(static) fn(func, obj, args) → {function}

绑定方法执行时的this指向的对象
Parameters:
Name Type Description
func function | String 要绑定的函数,或者一个在作用域下可用的函数名
obj Object 执行运行时this,如果不传入则运行时this为函数本身
args 函数执行时附加到执行时函数前面的参数
Source:
Returns:
封装后的函数
Type
function
Example
var a = {name:'Tom',age:16,say: function(){console.log('Tom aged ' + this.age)}};
a.say()
>> Tom aged 16
var b = {name:'Nancy',age:40};
b.say = a.say
b.say()
>> Tom aged 40
b.say = hui.fn(a.say, a);
b.say()
>> Tom aged 16

(static) inherits(child, parent)

原型继承
Parameters:
Name Type Description
child Class 子类
parent Class 父类
Source:
Example
hui.Form = function (options, pending) {
//如果使用this.constructor.superClass.call将无法继续继承此子类,否则会造成死循环!!
hui.Form.superClass.call(this, options, 'pending');
//进入控件处理主流程!
if (pending != 'pending') {
this.enterControl();
}
};
hui.Form.prototype = {
render: function () {
hui.Form.superClass.prototype.render.call(this);
//Todo...
}
};
hui.inherits(hui.Form, hui.Control);

(static) require(n, cb, asycopt)

请求需要的模块(和定义匿名模块类似)
Nodejs support 'require' and does not support 'define', browser does not supported both.
Parameters:
Name Type Attributes Description
n Array 依赖的模块
cb function 模块构造器
asyc String <optional>
'syc': 立即加载依赖, '': 否 (默认)
Source:
Example
hui.require(['jquery', 'button'], function () {
console.log('This is anonymous module.');
});

(static) showLog(msg)

弹出错误提示信息
Parameters:
Name Type Description
msg String 错误提示信息
Source:
Example
hui.showLog("Exception 'open failed: EACCES (Permission denied)'");