Plugin embed cleanup

This commit is contained in:
luboslenco
2023-03-25 22:55:01 +01:00
parent 2bae92e63a
commit 02e04d2ded
2 changed files with 54 additions and 44 deletions
+6 -1
View File
@@ -26,12 +26,17 @@ namespace {
}
}
#define SET_FUNCTION(object, name, fn)\
object->Set(String::NewFromUtf8(isolate, name).ToLocalChecked(),\
FunctionTemplate::New(isolate, fn, Local<v8::Value>(), Local<v8::Signature>(), 0,\
v8::ConstructorBehavior::kThrow, v8::SideEffectType::kHasNoSideEffect, nullptr))
void plugin_embed(Isolate *_isolate, Local<ObjectTemplate> global) {
isolate = _isolate;
Isolate::Scope isolate_scope(isolate);
HandleScope handle_scope(isolate);
Local<ObjectTemplate> krom_texsynth = ObjectTemplate::New(isolate);
krom_texsynth->Set(String::NewFromUtf8(isolate, "inpaint").ToLocalChecked(), FunctionTemplate::New(isolate, krom_texsynth_inpaint));
SET_FUNCTION(krom_texsynth, "inpaint", krom_texsynth_inpaint);
global->Set(String::NewFromUtf8(isolate, "Krom_texsynth").ToLocalChecked(), krom_texsynth);
}