Re-do bundling, compat tests, and extension API (#174)

This commit is contained in:
Aria 2022-05-25 00:37:18 +02:00 committed by GitHub
parent 5ee9a2543f
commit ec18687a98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
83 changed files with 1138 additions and 886 deletions

View file

@ -62,10 +62,16 @@ function createMechanism() {
function getSharedMechanism(): ReturnType<typeof createMechanism> {
const varName = '__dataverse_discoveryMechanism_sharedStack'
if (global) {
const root =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: {}
if (root) {
const existingMechanism: ReturnType<typeof createMechanism> | undefined =
// @ts-ignore ignore
global[varName]
root[varName]
if (
existingMechanism &&
typeof existingMechanism === 'object' &&
@ -75,7 +81,7 @@ function getSharedMechanism(): ReturnType<typeof createMechanism> {
} else {
const mechanism = createMechanism()
// @ts-ignore ignore
global[varName] = mechanism
root[varName] = mechanism
return mechanism
}
} else {