Exemplo n.º 1
0
v8::Handle<v8::ObjectTemplate> SessionWrapper::objectTemplate(v8::Isolate* pIsolate)
{
	v8::EscapableHandleScope handleScope(pIsolate);
	Poco::JS::Core::PooledIsolate* pPooledIso = Poco::JS::Core::PooledIsolate::fromIsolate(pIsolate);
	poco_check_ptr (pPooledIso);
	v8::Persistent<v8::ObjectTemplate>& pooledObjectTemplate(pPooledIso->objectTemplate("Data.Session"));
	if (pooledObjectTemplate.IsEmpty())
	{
		v8::Handle<v8::ObjectTemplate> objectTemplate = v8::ObjectTemplate::New();
		objectTemplate->SetInternalFieldCount(1);
		objectTemplate->SetAccessor(v8::String::NewFromUtf8(pIsolate, "connector"), getConnector);
		objectTemplate->SetAccessor(v8::String::NewFromUtf8(pIsolate, "connectionString"), getConnectionString);
		objectTemplate->SetAccessor(v8::String::NewFromUtf8(pIsolate, "isConnected"), getIsConnected);
		objectTemplate->SetAccessor(v8::String::NewFromUtf8(pIsolate, "isTransaction"), getIsTransaction);
		objectTemplate->SetAccessor(v8::String::NewFromUtf8(pIsolate, "pageSize"), getPageSize, setPageSize);

		objectTemplate->Set(v8::String::NewFromUtf8(pIsolate, "begin"), v8::FunctionTemplate::New(pIsolate, begin));
		objectTemplate->Set(v8::String::NewFromUtf8(pIsolate, "commit"), v8::FunctionTemplate::New(pIsolate, commit));
		objectTemplate->Set(v8::String::NewFromUtf8(pIsolate, "rollback"), v8::FunctionTemplate::New(pIsolate, rollback));
		objectTemplate->Set(v8::String::NewFromUtf8(pIsolate, "close"), v8::FunctionTemplate::New(pIsolate, close));
		objectTemplate->Set(v8::String::NewFromUtf8(pIsolate, "execute"), v8::FunctionTemplate::New(pIsolate, execute));

		pooledObjectTemplate.Reset(pIsolate, objectTemplate);
	}
	v8::Local<v8::ObjectTemplate> dateTimeTemplate = v8::Local<v8::ObjectTemplate>::New(pIsolate, pooledObjectTemplate);
	return handleScope.Escape(dateTimeTemplate);
}
v8::Handle<v8::ObjectTemplate> ServiceListenerWrapper::objectTemplate(v8::Isolate* pIsolate)
{
	v8::EscapableHandleScope handleScope(pIsolate);
	Poco::JS::Core::PooledIsolate* pPooledIso = Poco::JS::Core::PooledIsolate::fromIsolate(pIsolate);
	poco_check_ptr (pPooledIso);
	v8::Persistent<v8::ObjectTemplate>& pooledObjectTemplate(pPooledIso->objectTemplate("OSP.ServiceListener"));
	if (pooledObjectTemplate.IsEmpty())
	{
		v8::Handle<v8::ObjectTemplate> objectTemplate = v8::ObjectTemplate::New(pIsolate);
		objectTemplate->SetInternalFieldCount(1);
		objectTemplate->Set(v8::String::NewFromUtf8(pIsolate, "dispose"), v8::FunctionTemplate::New(pIsolate, dispose));
		pooledObjectTemplate.Reset(pIsolate, objectTemplate);
	}
	v8::Local<v8::ObjectTemplate> serviceListenerTemplate = v8::Local<v8::ObjectTemplate>::New(pIsolate, pooledObjectTemplate);
	return handleScope.Escape(serviceListenerTemplate);
}
Exemplo n.º 3
0
v8::Handle<v8::ObjectTemplate> TimerWrapper::objectTemplate(v8::Isolate* pIsolate)
{
    v8::EscapableHandleScope handleScope(pIsolate);
    Poco::JS::Core::PooledIsolate* pPooledIso = Poco::JS::Core::PooledIsolate::fromIsolate(pIsolate);
    poco_check_ptr (pPooledIso);
    v8::Persistent<v8::ObjectTemplate>& pooledObjectTemplate(pPooledIso->objectTemplate("Core.Timer"));
    if (pooledObjectTemplate.IsEmpty())
    {
        v8::Handle<v8::ObjectTemplate> objectTemplate = v8::ObjectTemplate::New();
        objectTemplate->SetInternalFieldCount(1);
        objectTemplate->SetAccessor(v8::String::NewFromUtf8(pIsolate, "cancelled"), cancelled);
        objectTemplate->Set(v8::String::NewFromUtf8(pIsolate, "cancel"), v8::FunctionTemplate::New(pIsolate, cancel));
        pooledObjectTemplate.Reset(pIsolate, objectTemplate);
    }
    v8::Local<v8::ObjectTemplate> timerTemplate = v8::Local<v8::ObjectTemplate>::New(pIsolate, pooledObjectTemplate);
    return handleScope.Escape(timerTemplate);
}
Exemplo n.º 4
0
v8::Handle<v8::ObjectTemplate> HTMLFormWrapper::objectTemplate(v8::Isolate* pIsolate)
{
	v8::EscapableHandleScope handleScope(pIsolate);
	Poco::JS::Core::PooledIsolate* pPooledIso = Poco::JS::Core::PooledIsolate::fromIsolate(pIsolate);
	poco_check_ptr (pPooledIso);
	v8::Persistent<v8::ObjectTemplate>& pooledObjectTemplate(pPooledIso->objectTemplate("Net.HTMLForm"));
	if (pooledObjectTemplate.IsEmpty())
	{
		v8::Handle<v8::ObjectTemplate> objectTemplate = v8::ObjectTemplate::New();
		objectTemplate->SetInternalFieldCount(1);
		objectTemplate->Set(v8::String::NewFromUtf8(pIsolate, "hasField"), v8::FunctionTemplate::New(pIsolate, hasField));
		objectTemplate->Set(v8::String::NewFromUtf8(pIsolate, "getField"), v8::FunctionTemplate::New(pIsolate, getField));
		pooledObjectTemplate.Reset(pIsolate, objectTemplate);
	}
	v8::Local<v8::ObjectTemplate> formTemplate = v8::Local<v8::ObjectTemplate>::New(pIsolate, pooledObjectTemplate);
	return handleScope.Escape(formTemplate);
}