2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef TIZENAPIS_TIZEN_JS_APPLICATION_H_
18 #define TIZENAPIS_TIZEN_JS_APPLICATION_H_
20 #include <JavaScriptCore/JavaScript.h>
21 #include <CommonsJavaScript/PrivateObject.h>
22 #include <API/Application/IApplication.h>
26 namespace Application {
28 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<Api::Application::IApplicationPtr>::Type JSApplicationPriv;
32 static const JSClassDefinition* getClassInfo();
34 static const JSClassRef getClassRef();
38 * The callback invoked when an object is first created.
40 static void initialize(JSContextRef context, JSObjectRef object);
43 * The callback invoked when an object is finalized.
45 static void finalize(JSObjectRef object);
48 * The callback invoked when an object is used as the target of an 'instanceof' expression.
50 static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
53 * Launches a application with given application id
55 static JSValueRef launch(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
56 const JSValueRef arguments[], JSValueRef* exception);
59 * Kills the application based on application context.
61 static JSValueRef kill(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
62 const JSValueRef arguments[], JSValueRef* exception);
65 * hide the application based on application context.
67 static JSValueRef hide(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
68 const JSValueRef arguments[], JSValueRef* exception);
71 * exit current application
73 static JSValueRef exit(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
74 const JSValueRef arguments[], JSValueRef* exception);
77 * Gets the list of installed packages.
79 static JSValueRef getAppsInfo(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
80 const JSValueRef arguments[], JSValueRef* exception);
83 * Gets the list of running packages.
85 static JSValueRef getAppsContext(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
86 const JSValueRef arguments[], JSValueRef* exception);
89 * Gets the application information of based on the package name.
91 static JSValueRef getAppInfo(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
92 const JSValueRef arguments[], JSValueRef* exception);
95 * Gets the current application Context
97 static JSValueRef getAppContext(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
98 const JSValueRef arguments[], JSValueRef* exception);
101 * Watch for changes on installed applicaiton.
103 static JSValueRef addAppInfoEventListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
104 const JSValueRef arguments[], JSValueRef* exception);
107 * Unset installed Applications listener
109 static JSValueRef removeAppInfoEventListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
110 const JSValueRef arguments[], JSValueRef* exception);
115 static JSValueRef launchService(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
116 const JSValueRef arguments[], JSValueRef* exception);
119 * get request application service
121 static JSValueRef getAppService(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
122 const JSValueRef arguments[], JSValueRef* exception);
125 * This structure contains properties and callbacks that define a type of object.
127 static JSClassDefinition m_classInfo;
130 * This structure describes a statically declared function property.
132 static JSStaticFunction m_function[];
134 static JSClassRef m_jsClassRef;