// Copyright (c) 2019 GitHub, Inc. All rights reserved. // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. #include "shell/common/gin_helper/object_template_builder.h" namespace gin_helper { ObjectTemplateBuilder::ObjectTemplateBuilder( v8::Isolate* isolate, v8::Local templ) : isolate_(isolate), template_(templ) {} ObjectTemplateBuilder& ObjectTemplateBuilder::SetImpl( const std::string_view name, v8::Local val) { template_->Set(gin::StringToSymbol(isolate_, name), val); return *this; } ObjectTemplateBuilder& ObjectTemplateBuilder::SetPropertyImpl( const std::string_view name, v8::Local getter, v8::Local setter) { template_->SetAccessorProperty(gin::StringToSymbol(isolate_, name), getter, setter); return *this; } v8::Local ObjectTemplateBuilder::Build() { v8::Local result = template_; template_.Clear(); return result; } } // namespace gin_helper