Skip to content

Commit a9af430

Browse files
author
cod1k
committed
Added a notation why do we need to do "bind()" here
1 parent 5514262 commit a9af430

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/cloudflare/src/utils/copyExecutionContext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function makeOverridableDescriptor<T extends ContextType>(
5757
if (store.has(method)) return store.get(method);
5858
const methodFunction = Reflect.get(ctx, method);
5959
if (typeof methodFunction !== 'function') return methodFunction;
60+
// We should do bind() to make sure that the method is bound to the context object - otherwise it will not work
6061
return methodFunction.bind(ctx);
6162
},
6263
};

0 commit comments

Comments
 (0)