refactor: rename the atom directory to shell
This commit is contained in:
parent
4575a4aae3
commit
d7f07e8a80
631 changed files with 0 additions and 0 deletions
29
shell/common/gin_util.h
Normal file
29
shell/common/gin_util.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright (c) 2018 Slack Technologies, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_COMMON_GIN_UTIL_H_
|
||||
#define ATOM_COMMON_GIN_UTIL_H_
|
||||
|
||||
#include "gin/converter.h"
|
||||
#include "gin/function_template.h"
|
||||
|
||||
namespace gin_util {
|
||||
|
||||
template <typename T>
|
||||
bool SetMethod(v8::Local<v8::Object> recv,
|
||||
const base::StringPiece& key,
|
||||
const T& callback) {
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
auto context = isolate->GetCurrentContext();
|
||||
return recv
|
||||
->Set(context, gin::StringToV8(isolate, key),
|
||||
gin::CreateFunctionTemplate(isolate, callback)
|
||||
->GetFunction(context)
|
||||
.ToLocalChecked())
|
||||
.ToChecked();
|
||||
}
|
||||
|
||||
} // namespace gin_util
|
||||
|
||||
#endif // ATOM_COMMON_GIN_UTIL_H_
|
Loading…
Add table
Add a link
Reference in a new issue