@aws-amplify/core
Version:
Core category of aws-amplify
15 lines (12 loc) • 382 B
text/typescript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
export const isWebWorker = () => {
if (typeof self === 'undefined') {
return false;
}
const selfContext = self as { WorkerGlobalScope?: any };
return (
typeof selfContext.WorkerGlobalScope !== 'undefined' &&
self instanceof selfContext.WorkerGlobalScope
);
};