Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALTV-659: JS module optimizations #351

Open
wants to merge 23 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d6fa0e5
ALTV-659: Added magic enum dependency
monntecc Jan 24, 2025
900ae7d
ALTV-659: Added js bindings support for server and client, move some …
monntecc Jan 24, 2025
5bbdeb1
ALTV-659: Move hash method to js
monntecc Jan 27, 2025
96659bc
ALTV-659: Remove unused js methods
monntecc Jan 27, 2025
787f463
ALTV-659: Added dynamic property handler
monntecc Jan 27, 2025
7605c56
ALTV-659: Move synced stream meta from cpp to js
monntecc Jan 27, 2025
f963fe0
ALTV-659: Move meta, syncedMeta and streamMeta functionality to js
monntecc Jan 27, 2025
5317700
ALTV-659: Added js helpers
monntecc Jan 28, 2025
dad8c6f
ALTV-659: Added enums bindings
monntecc Jan 28, 2025
fd44ea9
ALTV-659: Move timers methods to js
monntecc Jan 28, 2025
41a310d
ALTV-659: Fixed vector api
monntecc Jan 28, 2025
8b42b48
ALTV-659: Fixed compiled bindings error, when script cannot find cpp …
monntecc Jan 29, 2025
530d73c
ALTV-659: Refactored getBuiltinModule method
monntecc Jan 29, 2025
b8a6571
ALTV-659: Refactored resource code and fix cjs import
monntecc Jan 29, 2025
693cdcb
ALTV-659: Fixed meta props, update cpp sdk
monntecc Jan 30, 2025
d25e07b
ALTV-659: Fixed vector api
monntecc Jan 31, 2025
3f29c50
ALTV-659: Fixed browser bindings
monntecc Jan 31, 2025
721581d
ALTV-659: Added necessary methods to VirtualEntity
monntecc Jan 31, 2025
ba7d864
ALTV-659: Moved count static getter to js
monntecc Jan 31, 2025
710a645
ALTV-659: Improved v8 unhandled error stack trace
monntecc Jan 31, 2025
9f8ff7e
ALTV-659: Fixed hash method and RGBA class
monntecc Jan 31, 2025
7ec86ff
Merge remote-tracking branch 'origin/dev' into ALTV-659
monntecc Feb 3, 2025
a3097a8
ALTV-712: Added pragma once to generated bindings
monntecc Feb 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated
*.gen
shared/JSBindings.h
shared/JSEnums.h
shared/CompiledEnums.h
shared/CompiledBindings.h
shared/bindings-hashes.json

node_modules/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "shared/deps/cpp-sdk"]
path = shared/deps/cpp-sdk
url = https://github.com/altmp/cpp-sdk.git
[submodule "shared/deps/magic_enum"]
path = shared/deps/magic_enum
url = https://github.com/altmp/magic_enum.git
3 changes: 1 addition & 2 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ endmacro()
GroupSources(${PROJECT_SOURCE_DIR}/src "Source Files")
GroupSources("../shared" "Shared Files")

make_includable("src/bootstrap.js" "src/bootstrap.js.gen")

include_directories(
${ALTV_JS_CPP_SDK}
${ALTV_JS_DEPS_DIR}/v8/include
../shared
../shared/deps/magic_enum/include
${PROJECT_SOURCE_DIR}/src
)

Expand Down
37 changes: 16 additions & 21 deletions client/src/CV8Resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "workers/CWorker.h"

#include "JSBindings.h"
#include "CompiledBindings.h"

extern void StaticRequire(const v8::FunctionCallbackInfo<v8::Value>& info)
{
Expand Down Expand Up @@ -77,10 +77,6 @@ void CV8ResourceImpl::ProcessDynamicImports()
dynamicImports.clear();
}

extern std::string bootstrap_code =
#include "bootstrap.js.gen"
;

CV8ResourceImpl::CV8ResourceImpl(alt::IResource* resource, v8::Isolate* isolate) : V8ResourceImpl(isolate, resource)
{
v8::Locker locker(isolate);
Expand All @@ -96,8 +92,6 @@ CV8ResourceImpl::CV8ResourceImpl(alt::IResource* resource, v8::Isolate* isolate)
ctx->SetAlignedPointerInEmbedderData(1, resource);
}

extern V8Module altModule;

bool CV8ResourceImpl::Start()
{
if (resource->GetMain().empty()) return false;
Expand All @@ -111,8 +105,14 @@ bool CV8ResourceImpl::Start()
v8::Local<v8::Context> ctx = GetContext();
v8::Context::Scope context_scope(ctx);

V8ResourceImpl::Initialize();
V8ResourceImpl::Start();
SetupScriptGlobals();
SetupScriptGlobals(ctx);

V8ResourceImpl::InitializeBindings(js::Binding::Scope::CLIENT, V8Module::Get("alt"));

js::Binding bootstrapper = js::Binding::Get("client/bootstrap.js");
if (!bootstrapper.IsValid()) return false;

std::string path = resource->GetMain();
Log::Info << "[V8] Starting script " << path << Log::Endl;
Expand All @@ -123,23 +123,18 @@ bool CV8ResourceImpl::Start()
v8::MaybeLocal<v8::Module> maybeModule;
v8::ScriptOrigin scriptOrigin(isolate, V8Helpers::JSValue("<bootstrapper>"), 0, 0, false, -1,
v8::Local<v8::Value>(), false, false, true, v8::Local<v8::PrimitiveArray>());
v8::ScriptCompiler::Source source{V8Helpers::JSValue(bootstrap_code), scriptOrigin};
v8::ScriptCompiler::Source source{V8Helpers::JSValue(bootstrapper.GetSource()), scriptOrigin};
maybeModule = v8::ScriptCompiler::CompileModule(isolate, &source);

if (maybeModule.IsEmpty()) return false;

v8::Local<v8::Module> curModule = maybeModule.ToLocalChecked();

ctx->Global()->Set(ctx, V8Helpers::JSValue("__internal_get_exports"),
v8::Function::New(ctx, &StaticRequire).ToLocalChecked());
ctx->Global()->Set(ctx, V8Helpers::JSValue("__internal_bindings_code"),
V8Helpers::JSValue(JSBindings::GetBindingsCode()));
ctx->Global()->Set(ctx, V8Helpers::JSValue("__internal_main_path"), V8Helpers::JSValue(path));
ctx->Global()->Set(ctx, V8Helpers::JSValue("__internal_start_file"),
v8::Function::New(ctx, &StartFile).ToLocalChecked());
js::TemporaryGlobalExtension internalGetExports(GetContext(), "__internal_get_exports", v8::Function::New(ctx, &StaticRequire).ToLocalChecked());
js::TemporaryGlobalExtension internalMainPath(GetContext(), "__internal_main_path", V8Helpers::JSValue(path));
js::TemporaryGlobalExtension internalStartFile(GetContext(), "__internal_start_file", v8::Function::New(ctx, &StartFile).ToLocalChecked());

bool result = InstantiateModule(curModule);
if (!result) return false;
if (!InstantiateModule(curModule)) return false;

Log::Info << "[V8] Started script " << path << Log::Endl;
return true;
Expand Down Expand Up @@ -568,14 +563,14 @@ v8::MaybeLocal<v8::Value> EvaluateSyntheticModule(v8::Local<v8::Context> context
v8::Local<v8::Module> CV8ResourceImpl::CreateSyntheticModule(const std::string& name, v8::Local<v8::Value> exportValue)
{
v8::Local<v8::String> defaultExport = V8Helpers::JSValue("default");
v8::MemorySpan<const v8::Local<v8::String>> exports = { &defaultExport, 1 };
v8::MemorySpan<const v8::Local<v8::String>> exports = { &defaultExport, 1 };

v8::Local<v8::Module> syntheticModule = v8::Module::CreateSyntheticModule(
isolate, V8Helpers::JSValue(name), exports, &EvaluateSyntheticModule);
isolate, V8Helpers::JSValue(name), exports, &EvaluateSyntheticModule);

syntheticModuleExports.insert({
syntheticModule->GetIdentityHash(), V8Helpers::CPersistent<v8::Value>(isolate, exportValue)
});
});

return syntheticModule;
}
Expand Down
15 changes: 8 additions & 7 deletions client/src/CV8ScriptRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
#include "inspector/CV8InspectorChannel.h"
#include "V8Module.h"
#include "events/Events.h"
#include "CProfiler.h"
#include "CProfiler.h"
#include <Windows.h>

CV8ScriptRuntime::CV8ScriptRuntime()
{
// !!! Don't change these without adjusting bytecode module !!!
v8::V8::SetFlagsFromString("--harmony-import-assertions --short-builtin-calls --no-lazy --no-flush-bytecode");
platform = v8::platform::NewDefaultPlatform();
v8::LogEventCallback;
platform = v8::platform::NewDefaultPlatform();

v8::LogEventCallback;

v8::V8::InitializePlatform(platform.get());
v8::V8::InitializeICU((alt::ICore::Instance().GetClientPath() + "/libs/icudtl_v8.dat").c_str());
Expand Down Expand Up @@ -218,10 +218,9 @@ CV8ScriptRuntime::CV8ScriptRuntime()
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);

V8Class::LoadAll(isolate);

V8Class::Initialize(isolate);
extern V8Module altModule, nativesModule, sharedModule;
V8Module::Add(isolate, { altModule, nativesModule, sharedModule });
V8Module::Add({ altModule, nativesModule, sharedModule });
}

RegisterEvents();
Expand Down Expand Up @@ -250,6 +249,8 @@ void CV8ScriptRuntime::OnDispose()

if(CProfiler::Instance().IsEnabled()) CProfiler::Instance().Dump(alt::ICore::Instance().GetClientPath());

V8Class::UnloadAll(isolate);
V8Module::Cleanup(isolate);
CV8ScriptRuntime::SetInstance(nullptr);
delete this;
}
Expand Down
16 changes: 8 additions & 8 deletions client/src/IImportHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static inline v8::MaybeLocal<v8::Module> CompileESM(v8::Isolate* isolate, const

static inline bool IsSystemModule(v8::Isolate* isolate, const std::string& name)
{
return V8Module::Exists(isolate, name);
return V8Module::Exists(name);
}

static inline v8::MaybeLocal<v8::Module> WrapModule(v8::Isolate* isolate, const std::deque<std::string>& _exportKeys, const std::string& name, bool exportAsDefault = false)
Expand Down Expand Up @@ -44,7 +44,7 @@ static inline v8::MaybeLocal<v8::Module> WrapModule(v8::Isolate* isolate, const
bool IImportHandler::IsValidModule(const std::string& name)
{
v8::Isolate* isolate = v8::Isolate::GetCurrent();
if(V8Module::Exists(isolate, name)) return true;
if(V8Module::Exists(name)) return true;

alt::IResource* resource = alt::ICore::Instance().GetResource(name);
if(resource) return true;
Expand All @@ -66,10 +66,10 @@ std::deque<std::string> IImportHandler::GetModuleKeys(const std::string& name)
{
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Local<v8::Context> context = isolate->GetEnteredOrMicrotaskContext();
auto v8module = V8Module::All()[isolate].find(name);
if(v8module != V8Module::All()[isolate].end())
if(V8Module::Exists(name))
{
auto _exports = v8module->second->GetExports(isolate, context);
V8Module& module = V8Module::Get(name);
auto _exports = module.GetModuleExports(isolate);
v8::Local<v8::Array> v8Keys = _exports->GetOwnPropertyNames(context).ToLocalChecked();

std::deque<std::string> keys;
Expand Down Expand Up @@ -131,10 +131,10 @@ v8::MaybeLocal<v8::Value> IImportHandler::Require(const std::string& name)
auto it = requiresMap.find(name);
if(it != requiresMap.end()) return it->second.Get(isolate);

auto v8module = V8Module::All()[isolate].find(name);
if(v8module != V8Module::All()[isolate].end())
if (V8Module::Exists(name))
{
auto _exports = v8module->second->GetExports(isolate, isolate->GetEnteredOrMicrotaskContext());
V8Module& module = V8Module::Get(name);
auto _exports = module.GetModuleExports(isolate);
requiresMap.insert({ name, V8Helpers::CPersistent<v8::Value>{ isolate, _exports } });

return _exports;
Expand Down
9 changes: 6 additions & 3 deletions client/src/PromiseRejections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ void V8Helpers::PromiseRejections::ProcessQueue(CV8ResourceImpl* resource)
auto moduleData = resource->GetModuleData(fileName);
if(rejection->location.GetLineNumber() != 0 && !moduleData.isBytecode)
{
Log::Error << "[V8] Unhandled promise rejection at " << resource->GetResource()->GetName() << ":" << fileName << ":" << rejection->location.GetLineNumber() << " ("
<< rejectionMsg << ")" << Log::Endl;
Log::Error << "[V8] Unhandled promise rejection at resource [" << resource->GetResource()->GetName() << "]: "
<< "File name: [" << fileName << "], function: [" << rejection->location.GetFuncName() << "], line number:" << rejection->location.GetLineNumber() << ", error: ["
<< rejectionMsg << "]" << Log::Endl;
}
else
{
Log::Error << "[V8] Unhandled promise rejection at " << resource->GetResource()->GetName() << ":" << fileName << " (" << rejectionMsg << ")" << Log::Endl;
Log::Error << "[V8] Unhandled promise rejection at resource [" << resource->GetResource()->GetName() << "]: "
<< "File name: [" << fileName << "], function: [" << rejection->location.GetFuncName() << "], line number:" << rejection->location.GetLineNumber() << ", error: ["
<< rejectionMsg << "]" << Log::Endl;
}
rejection->stackTrace.Print(1);

Expand Down
6 changes: 0 additions & 6 deletions client/src/bindings/Audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,6 @@ static void AllAudioGetter(v8::Local<v8::String> name, const v8::PropertyCallbac
V8_RETURN(jsArr);
}

static void AudioCountGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_RETURN_UINT(alt::ICore::Instance().GetBaseObjects(alt::IBaseObject::Type::AUDIO).size());
}

static void StaticGetByID(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT_RESOURCE();
Expand Down Expand Up @@ -167,7 +162,6 @@ extern V8Class v8Audio("Audio",
V8Helpers::SetStaticMethod(isolate, tpl, "getByID", StaticGetByID);

V8Helpers::SetStaticAccessor(isolate, tpl, "all", &AllAudioGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "count", &AudioCountGetter);

V8Helpers::SetMethod(isolate, tpl, "on", &On);
V8Helpers::SetMethod(isolate, tpl, "off", &Off);
Expand Down
6 changes: 0 additions & 6 deletions client/src/bindings/AudioOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ static void AllAudioOutputGetter(v8::Local<v8::String> name, const v8::PropertyC
V8_RETURN(resource->GetAllAudioOutputs());
}

static void AudioOutputCountGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_RETURN_UINT(alt::ICore::Instance().GetBaseObjects(alt::IBaseObject::Type::AUDIO_OUTPUT).size());
}

static void GetFilter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT_RESOURCE();
Expand Down Expand Up @@ -66,7 +61,6 @@ extern V8Class v8AudioOutput("AudioOutput",
v8::Isolate* isolate = v8::Isolate::GetCurrent();

V8Helpers::SetStaticAccessor(isolate, tpl, "all", &AllAudioOutputGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "count", &AudioOutputCountGetter);

V8Helpers::SetAccessor<IAudioOutput, bool, &IAudioOutput::IsMuted, &IAudioOutput::SetMuted>(isolate, tpl, "muted");
V8Helpers::SetAccessor<IAudioOutput, float, &IAudioOutput::GetVolume, &IAudioOutput::SetVolume>(isolate, tpl, "volume");
Expand Down
6 changes: 0 additions & 6 deletions client/src/bindings/Checkpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ static void AllGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo
V8_RETURN(resource->GetAllCheckpoints());
}

static void CountGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_RETURN_UINT(alt::ICore::Instance().GetBaseObjects(alt::IBaseObject::Type::CHECKPOINT).size());
}

static void StaticGetByID(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT_RESOURCE();
Expand Down Expand Up @@ -170,7 +165,6 @@ extern V8Class v8Checkpoint("Checkpoint",
V8Helpers::SetAccessor<ICheckpoint, uint32_t, &ICheckpoint::GetGameID>(isolate, tpl, "scriptID");

V8Helpers::SetStaticAccessor(isolate, tpl, "all", &AllGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "count", &CountGetter);
V8Helpers::SetStaticMethod(isolate, tpl, "getByID", StaticGetByID);
V8Helpers::SetStaticMethod(isolate, tpl, "getByScriptID", StaticGetByScriptID);

Expand Down
6 changes: 0 additions & 6 deletions client/src/bindings/LocalObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,6 @@ static void AllGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo
V8_RETURN(resource->GetAllLocalObjects());
}

static void CountGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_RETURN_UINT(alt::ICore::Instance().GetBaseObjects(alt::IBaseObject::Type::LOCAL_OBJECT).size());
}

static void AllWorldGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT_RESOURCE();
Expand Down Expand Up @@ -262,7 +257,6 @@ extern V8Class v8LocalObject("LocalObject",
V8Helpers::SetStaticMethod(isolate, tpl, "getByScriptID", StaticGetByScriptID);

V8Helpers::SetStaticAccessor(isolate, tpl, "all", &AllGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "count", &CountGetter);

V8Helpers::SetStaticAccessor(isolate, tpl, "allWorld", &AllWorldGetter);

Expand Down
6 changes: 0 additions & 6 deletions client/src/bindings/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ static void ToString(const v8::FunctionCallbackInfo<v8::Value>& info)
V8_RETURN_STRING(ss.str());
}

static void CountGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_RETURN_UINT(alt::ICore::Instance().GetBaseObjects(alt::IBaseObject::Type::OBJECT).size());
}

static void StreamedInGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT_RESOURCE();
Expand Down Expand Up @@ -110,7 +105,6 @@ extern V8Class v8Object("Object", v8Entity, [](v8::Local<v8::FunctionTemplate> t
V8Helpers::SetStaticMethod(isolate, tpl, "getByRemoteID", StaticGetByRemoteId);

V8Helpers::SetStaticAccessor(isolate, tpl, "all", &AllGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "count", &CountGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "streamedIn", &StreamedInGetter);

V8Helpers::SetAccessor<alt::IObject, uint8_t, &alt::IObject::GetAlpha>(isolate, tpl, "alpha");
Expand Down
6 changes: 0 additions & 6 deletions client/src/bindings/Ped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ static void AllGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo
V8_RETURN(resource->GetAllPeds());
}

static void CountGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_RETURN_UINT(alt::ICore::Instance().GetBaseObjects(alt::IBaseObject::Type::PED).size());
}

static void StreamedInGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT_RESOURCE();
Expand Down Expand Up @@ -96,7 +91,6 @@ extern V8Class v8Ped("Ped", v8Entity, [](v8::Local<v8::FunctionTemplate> tpl)
v8::Isolate* isolate = v8::Isolate::GetCurrent();

V8Helpers::SetStaticAccessor(isolate, tpl, "all", &AllGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "count", &CountGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "streamedIn", &StreamedInGetter);
V8Helpers::SetStaticMethod(isolate, tpl, "getByID", StaticGetByID);
V8Helpers::SetStaticMethod(isolate, tpl, "getByScriptID", StaticGetByScriptID);
Expand Down
6 changes: 0 additions & 6 deletions client/src/bindings/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ static void AllGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo
V8_RETURN(resource->GetAllPlayers());
}

static void CountGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_RETURN_UINT(alt::ICore::Instance().GetBaseObjects(alt::IBaseObject::Type::PLAYER).size());
}

static void StreamedInGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT_RESOURCE();
Expand Down Expand Up @@ -221,7 +216,6 @@ extern V8Class v8Player("Player",
V8Helpers::SetStaticMethod(isolate, tpl, "getByRemoteID", StaticGetByRemoteId);

V8Helpers::SetStaticAccessor(isolate, tpl, "all", &AllGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "count", &CountGetter);

V8Helpers::SetStaticAccessor(isolate, tpl, "streamedIn", &StreamedInGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "local", &LocalGetter);
Expand Down
8 changes: 1 addition & 7 deletions client/src/bindings/Vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ static void AllGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo
V8_RETURN(resource->GetAllVehicles());
}

static void CountGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_RETURN_UINT(alt::ICore::Instance().GetBaseObjects(alt::IBaseObject::Type::VEHICLE).size());
}

static void StreamedInGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT_RESOURCE();
Expand Down Expand Up @@ -313,7 +308,7 @@ static void SetupTransmission(const v8::FunctionCallbackInfo<v8::Value>& info)
{
V8_GET_ISOLATE_CONTEXT();
V8_GET_THIS_BASE_OBJECT(vehicle, alt::IVehicle);
V8_CHECK_ARGS_LEN(0);
V8_CHECK_ARGS_LEN(0);

vehicle->SetupTransmission();
}
Expand Down Expand Up @@ -351,7 +346,6 @@ extern V8Class v8Vehicle("Vehicle",
V8Helpers::SetStaticMethod(isolate, tpl, "getByRemoteID", StaticGetByRemoteId);

V8Helpers::SetStaticAccessor(isolate, tpl, "all", &AllGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "count", &CountGetter);
V8Helpers::SetStaticAccessor(isolate, tpl, "streamedIn", &StreamedInGetter);

// Common getters
Expand Down
Loading