Skip to content

Commit 083205c

Browse files
authored
Revert "Blob: Add factory function" (#123)
Reverts #120
1 parent 7c38107 commit 083205c

File tree

3 files changed

+1
-40
lines changed

3 files changed

+1
-40
lines changed
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
#pragma once
22

33
#include <napi/env.h>
4-
#include <napi/napi.h>
54
#include <Babylon/Api.h>
6-
#include <vector>
7-
#include <string>
85

96
namespace Babylon::Polyfills::Blob
107
{
118
void BABYLON_API Initialize(Napi::Env env);
12-
13-
Napi::Value BABYLON_API CreateInstance(
14-
Napi::Env env,
15-
std::vector<std::byte> data,
16-
std::string type);
179
}

Polyfills/Blob/Source/Blob.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44

55
namespace Babylon::Polyfills::Internal
66
{
7-
static constexpr auto JS_BLOB_CONSTRUCTOR_NAME = "Blob";
8-
97
void Blob::Initialize(Napi::Env env)
108
{
9+
static constexpr auto JS_BLOB_CONSTRUCTOR_NAME = "Blob";
1110
if (env.Global().Get(JS_BLOB_CONSTRUCTOR_NAME).IsUndefined())
1211
{
1312
Napi::Function func = DefineClass(
@@ -25,23 +24,6 @@ namespace Babylon::Polyfills::Internal
2524
}
2625
}
2726

28-
Napi::Value Blob::CreateInstance(
29-
Napi::Env env,
30-
std::vector<std::byte> data,
31-
std::string type)
32-
{
33-
Initialize(env);
34-
35-
auto ctor{env.Global().Get(JS_BLOB_CONSTRUCTOR_NAME).As<Napi::Function>()};
36-
auto jsBlob{ctor.New({})};
37-
38-
auto blob{Blob::Unwrap(jsBlob)};
39-
blob->m_data = std::move(data);
40-
blob->m_type = std::move(type);
41-
42-
return jsBlob;
43-
}
44-
4527
Blob::Blob(const Napi::CallbackInfo& info)
4628
: Napi::ObjectWrap<Blob>(info)
4729
{
@@ -151,12 +133,4 @@ namespace Babylon::Polyfills::Blob
151133
{
152134
Internal::Blob::Initialize(env);
153135
}
154-
155-
Napi::Value BABYLON_API CreateInstance(
156-
Napi::Env env,
157-
std::vector<std::byte> data,
158-
std::string type)
159-
{
160-
return Internal::Blob::CreateInstance(env, std::move(data), std::move(type));
161-
}
162136
}

Polyfills/Blob/Source/Blob.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ namespace Babylon::Polyfills::Internal
1212
public:
1313
static void Initialize(Napi::Env env);
1414

15-
static Napi::Value CreateInstance(
16-
Napi::Env env,
17-
std::vector<std::byte> data,
18-
std::string type);
19-
2015
explicit Blob(const Napi::CallbackInfo& info);
2116

2217
private:

0 commit comments

Comments
 (0)