Skip to content

Commit

Permalink
Updates argument naming
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamind committed Jan 23, 2023
1 parent b4d420d commit a086dfd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/comlink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function isAllowedOrigin(
allowedOrigins: (string | RegExp)[],
origin: string
): boolean {
for (const allowedOrigin of origins) {
for (const allowedOrigin of allowedOrigins) {
if (origin === allowedOrigin || allowedOrigin === "*") {
return true;
}
Expand All @@ -299,13 +299,13 @@ function isAllowedOrigin(
export function expose(
obj: any,
ep: Endpoint = self as any,
origins: (string | RegExp)[] = ["*"]
allowedOrigins: (string | RegExp)[] = ["*"]
) {
ep.addEventListener("message", function callback(ev: MessageEvent) {
if (!ev || !ev.data) {
return;
}
if (!isAllowedOrigin(origins, ev.origin)) {
if (!isAllowedOrigin(allowedOrigins, ev.origin)) {
console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);
return;
}
Expand Down

0 comments on commit a086dfd

Please sign in to comment.