Skip to content

Commit 74a4028

Browse files
authored
refactor: rename __getStore global JS var to __brownieGetStore to reduce 3p globals collision risk (#190)
1 parent 5dc45ce commit 74a4028

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

packages/brownie/cpp/BrownieInstaller.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace brownie {
66

77
void BrownieInstaller::install(facebook::jsi::Runtime &runtime) {
88
auto getStore = facebook::jsi::Function::createFromHostFunction(
9-
runtime, facebook::jsi::PropNameID::forAscii(runtime, "__getStore"), 1,
9+
runtime, facebook::jsi::PropNameID::forAscii(runtime, "__brownieGetStore"), 1,
1010
[](facebook::jsi::Runtime &rt, const facebook::jsi::Value &,
1111
const facebook::jsi::Value *args, size_t count) -> facebook::jsi::Value {
1212
if (count < 1 || !args[0].isString()) {
@@ -25,7 +25,7 @@ void BrownieInstaller::install(facebook::jsi::Runtime &runtime) {
2525
return facebook::jsi::Object::createFromHostObject(rt, hostObject);
2626
});
2727

28-
runtime.global().setProperty(runtime, "__getStore", getStore);
28+
runtime.global().setProperty(runtime, "__brownieGetStore", getStore);
2929
}
3030

3131
} // namespace brownie

packages/brownie/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const stores = new Map<string, StoreCache>();
2323

2424
function getHostObject(key: string): HostObject {
2525
// @ts-expect-error - untyped global prop set by BrownieInstaller.cpp
26-
return global.__getStore?.(key);
26+
return global.__brownieGetStore?.(key);
2727
}
2828

2929
function getOrCreateStore(key: string): StoreCache {

0 commit comments

Comments
 (0)