Commit cfba5bad authored by 李增强's avatar 李增强

增加初始化完成等待

parent 44ad10bd
......@@ -17,6 +17,7 @@ class QMTJ {
static Page _page;
static Tap _tap;
static Exposure _exposure;
static Future<bool> _ready;
static void debug() {
Utils.debug();
......@@ -39,6 +40,7 @@ class QMTJ {
_tap = Tap(_db);
_exposure = Exposure(_db);
_db.init();
_ready = new Future.value(true);
Future.delayed(Duration(seconds: 5)).then((value) async {
await _app.upload();
await _page.upload();
......@@ -49,23 +51,27 @@ class QMTJ {
/// APP 可见
static void onAppResume({Map<String, dynamic> extras}) async {
await _ready;
_app.onResume(extras: extras);
}
/// APP 不可见
static void onAppPause() async {
await _ready;
_app.onPause();
}
/// PAGE 可见
static void onPageResume(
{String pageId, String lastPageId, Map<String, dynamic> extras}) async {
await _ready;
_page.onResume(pageId: pageId, lastPageId: lastPageId, extras: extras);
}
/// PAGE 不可见
static void onPagePause(
{String pageId, String lastPageId, Map<String, dynamic> extras}) async {
await _ready;
_page.onPause(pageId: pageId, lastPageId: lastPageId, extras: extras);
}
......@@ -75,6 +81,7 @@ class QMTJ {
/// [extras] 点击参数
static void tap(
{String pageId, String clickId, Map<String, dynamic> extras}) async {
await _ready;
_tap.onTap(pageId: pageId, clickId: clickId, extras: extras);
}
......@@ -84,6 +91,7 @@ class QMTJ {
/// [extras] 曝光参数
static void exposure(
{String pageId, String exposureId, Map<String, dynamic> extras}) async {
await _ready;
_exposure.onExposure(
pageId: pageId, exposureId: exposureId, extras: extras);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment