1 Star 0 Fork 6

northqd/async

forked from 方瑾/async 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
node.c 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
方瑾 提交于 2019-04-14 19:27 . update
#include"node.h"
static Emitter emitter = NULL;
static EventLoop eventLoop = NULL;
void initRunTime() {
emitter = createEmitter();
eventLoop = initEventLoop();
}
EventLoop getEventLoop() {
return eventLoop;
}
void NextTick(Task task, let args) {
nextTick(eventLoop, task, args);
}
Runtime SetTimeout(Task task, let args, int millisec) {
return setTimeout(eventLoop, task, args, millisec);
}
Runtime SetInterval(Task task, let args, int millisec) {
return setInterval(eventLoop, task, args, millisec);
}
void BeginDealTaskQueue() {
beginDealTaskQueue(eventLoop);
freeEmitter(&emitter);
}
void OnEvent(char * eventName, Listener listener, let args) {
emitter->on(emitter, eventName, listener, args);
}
void OnEventOnce(char * eventName, Listener listener, let args) {
emitter->once(emitter, eventName, listener, args);
}
void EmitEvent(char * eventName) {
emitter->emit(emitter, eventName);
}
void OnEventPrependListener(char * eventName, Listener listener, let args) {
emitter->prependListener(emitter, eventName, listener, args);
}
void OnEventPrependOnceListener(char * eventName, Listener listener, let args) {
emitter->prependOnceListener(emitter, eventName, listener, args);
}
void RemoveListenerEvent(char * eventName) {
emitter->removeListener(emitter, eventName);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/northqd2018/async.git
git@gitee.com:northqd2018/async.git
northqd2018
async
async
master

搜索帮助