Skip to content

Commit

Permalink
feat: URL & URLSearchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
triniwiz authored and NathanWalker committed Jan 31, 2024
1 parent 17a5c5f commit 1111636
Show file tree
Hide file tree
Showing 12 changed files with 23,949 additions and 0 deletions.
15,598 changes: 15,598 additions & 0 deletions NativeScript/ada/ada.cpp

Large diffs are not rendered by default.

7,153 changes: 7,153 additions & 0 deletions NativeScript/ada/ada.h

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions NativeScript/runtime/Runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class Runtime {
void DefinePerformanceObject(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> globalTemplate);
void DefineTimeMethod(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> globalTemplate);
void DefineDrainMicrotaskMethod(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> globalTemplate);

void DefineURL(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> globalTemplate);

void DefineURLSearchParams(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> globalTemplate);

static void PerformanceNowCallback(const v8::FunctionCallbackInfo<v8::Value>& args);
v8::Isolate* isolate_;
std::unique_ptr<ModuleInternal> moduleInternal_;
Expand Down
17 changes: 17 additions & 0 deletions NativeScript/runtime/Runtime.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include "DisposerPHV.h"

#include "ModuleBinding.hpp"
#include "URLImpl.h"
#include "URLSearchParamsImpl.h"

#define STRINGIZE(x) #x
#define STRINGIZE_VALUE_OF(x) STRINGIZE(x)
Expand Down Expand Up @@ -315,6 +317,21 @@ void DisposeIsolateWhenPossible(Isolate* isolate) {
return std::find(Runtime::isolates_.begin(), Runtime::isolates_.end(), isolate) != Runtime::isolates_.end();
}


void Runtime::DefineURL(Isolate* isolate, Local<ObjectTemplate> globalTemplate) {
auto URLTemplate = URLImpl::GetCtor(isolate);

Local<v8::String> urlPropertyName = ToV8String(isolate, "URLImpl");
globalTemplate->Set(urlPropertyName, URLTemplate);
}

void Runtime::DefineURLSearchParams(Isolate* isolate, Local<ObjectTemplate> globalTemplate) {
auto URLSearchParamsTemplate = URLSearchParamsImpl::GetCtor(isolate);

Local<v8::String> urlSearchParamsPropertyName = ToV8String(isolate, "URLSearchParamsImpl");
globalTemplate->Set(urlSearchParamsPropertyName, URLSearchParamsTemplate);
}

std::shared_ptr<Platform> Runtime::platform_;
std::vector<Isolate*> Runtime::isolates_;
bool Runtime::v8Initialized_ = false;
Expand Down
Loading

0 comments on commit 1111636

Please sign in to comment.