modify for awtk-web-js

This commit is contained in:
xianjimli 2019-05-02 18:46:45 +08:00
parent 6a74a00321
commit 5434aec053
6 changed files with 28 additions and 2 deletions

View File

@ -1,4 +1,7 @@
# 最新动态
* 2019/05/02
* 支持AWTK-JS的开发的应用程序在WEB上运行。
* 2019/05/01
* 修改image base函数名在jerryscript中引起的问题。

View File

@ -123,7 +123,7 @@ ret_t canvas_set_clip_rect(canvas_t* c, const rect_t* r_in) {
lcd_w = c->lcd->w;
lcd_h = c->lcd->h;
if (r) {
c->clip_left = tk_max(0, r->x);
c->clip_top = tk_max(0, r->y);

View File

@ -22,11 +22,19 @@
#include "base/idle_info.h"
#include "base/idle_manager.h"
#ifdef AWTK_WEB_JS
#include <emscripten.h>
#endif /*AWTK_WEB_JS*/
static ret_t idle_info_on_destroy(idle_info_t* info) {
if (info->on_destroy != NULL) {
info->on_destroy(info);
}
#ifdef AWTK_WEB_JS
EM_ASM_INT({ return TBrowser.releaseFunction($0); }, info->on_idle);
#endif /*AWTK_WEB_JS*/
return RET_OK;
}

View File

@ -22,11 +22,19 @@
#include "base/timer_info.h"
#include "base/timer_manager.h"
#ifdef AWTK_WEB_JS
#include <emscripten.h>
#endif /*AWTK_WEB_JS*/
static ret_t timer_info_on_destroy(timer_info_t* info) {
if (info->on_destroy != NULL) {
info->on_destroy(info);
}
#ifdef AWTK_WEB_JS
EM_ASM_INT({ return TBrowser.releaseFunction($0); }, info->on_timer);
#endif /*AWTK_WEB_JS*/
return RET_OK;
}

8
src/tkc/emitter.c Executable file → Normal file
View File

@ -39,11 +39,19 @@ emitter_t* emitter_init(emitter_t* emitter) {
return emitter;
}
#ifdef AWTK_WEB_JS
#include <emscripten.h>
#endif /*AWTK_WEB_JS*/
static ret_t emitter_item_destroy(emitter_item_t* iter) {
if (iter->on_destroy) {
iter->on_destroy(iter);
}
#ifdef AWTK_WEB_JS
EM_ASM_INT({ return TBrowser.releaseFunction($0); }, iter->handler);
#endif /*AWTK_WEB_JS*/
memset(iter, 0x00, sizeof(emitter_item_t));
TKMEM_FREE(iter);

View File

@ -304,4 +304,3 @@ object_t* object_default_clone(object_default_t* o) {
ret_t object_default_unref(object_t* obj) {
return object_unref(obj);
}