-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWorker.h
More file actions
36 lines (28 loc) · 972 Bytes
/
Worker.h
File metadata and controls
36 lines (28 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef WORKER_H
#define WORKER_H
#include <memory>
#include <string>
#include <vector>
#include "native_api_util.h"
#include "runtime/modules/worker/Message.h"
namespace nativescript {
class Worker {
public:
static void Init(napi_env env, napi_value global, bool isWorkerThread);
static void Init(napi_env env, napi_value global);
private:
static JS_METHOD(Constructor);
static void Finalize(napi_env env, void* nativeObject,
void* finalize_hint);
static JS_METHOD(PostMessage);
static JS_METHOD(Terminate);
static void OnMessage(napi_env env, napi_value jsThis,
std::shared_ptr<worker::Message>);
static JS_METHOD(PostMessageToMain);
static JS_METHOD(CloseWorker);
static napi_value Serialize(napi_env env, napi_value value);
static void SetWorkerId(napi_env env, int workerId);
static int GetWorkerId(napi_env env, napi_value global);
};
} // namespace nativescript
#endif // WORKER_H