2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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.
19 #include "object-template-helper.h"
23 #include <signals/signal-manager.h>
32 namespace ObjectTemplateHelper
35 void AddSignalConnectAndDisconnect( v8::Isolate* isolate, v8::Local<v8::ObjectTemplate>& objTemplate )
37 objTemplate->Set( v8::String::NewFromUtf8( isolate, "connect"),
38 v8::FunctionTemplate::New( isolate, SignalManager::SignalConnect) );
42 objTemplate->Set( v8::String::NewFromUtf8( isolate, "disconnect"),
43 v8::FunctionTemplate::New( isolate, SignalManager::SignalDisconnect) );
49 void InstallFunctions( v8::Isolate* isolate,
50 v8::Local<v8::ObjectTemplate>& objTemplate,
51 const ApiFunction* functionTable,
52 unsigned int tableCount,
55 // add our function properties
56 for( unsigned int i = 0; i < tableCount; ++i )
58 const ApiFunction property = functionTable[i];
62 if( type == NORMAL_FUNCTIONS )
64 funcName = V8Utils::GetJavaScriptFunctionName( property.name);
69 funcName = property.name;
71 // printf("Installing function %s \n", funcName.c_str() );
72 objTemplate->Set( v8::String::NewFromUtf8( isolate, funcName.c_str() ),
73 v8::FunctionTemplate::New( isolate, property.function ) );
77 } // ObjectTemplateHelper