写在前面
Module模式最初被定义为一种在传统软件工程中为类提供私有和公有封装的方法。而在Javascript中,Module模式用于进一步模拟类的概念,通过这种方式,能够使一个单独的对象拥有公有/私有的方法和变量,从而屏蔽来自全局作用域的特殊部分。产生的结果是:函数名与在页面上其他脚本定义的函数冲突的可能性降低。
应当注意的一点是:在Javascript没有private访问修饰符因此算不得真正的私有,而是通过函数作用域来模拟私有这个概念。在Module模式内由于闭包的存在,声明的变量和方法只在该模式内部可用,但在返回对象上定义的变量和方法是可以对外访问的。
more
示例
var testModule=(functi继续阅读 »
New features
Add automaticlly check libc interfaces
Support custom allocator
Add trace for allocator in the debug mode
Add static_pool module
Add stream interfaces for reading all data to string
Add adler32 hash algorithm
Add tb_memmem interface
Add regex module with pcre, pcre2 or posix regex
Changes
Optimize stre继续阅读 »
New features
Add wait multi-processes interface
Add uuid generator
Add hash library module
Add __tb_deprecated__ keyword and option
Changes
Move some utils interfaces to the hash module
Rewrite random generator
Bugs fixed
Fix stdout compatibility issue for vs2015
Fix process arguments length limit继续阅读 »
New features
Support make command and compile directly without xmake
Add switch context interfaces into platform module
Add coroutine module (supports i386, x86_64, arm, arm64 ..)
Add simple http server demo using coroutine
Add simple spider using coroutine
Add io poller interfaces(with epoll, poll, kqueue, select)
Su继续阅读 »
xmake v2.0 has supported the plugin module and we can develop ourself plugin module conveniently.
We can run command xmake -h to look over some builtin plugins of xmake
Plugins:
l, lua Run the lua script.
m, macro Run the given macro.继续阅读 »