summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-11 17:37:06 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-11 17:37:06 +0100
commitbf7703f5915c6154937f3febf812aad6483bff45 (patch)
tree384be2f9fff05e755669b14f2f8fa0a624dacf45 /src/utils
parentf2513baf3c9262190ee2c92fb98b2dd099bfbab2 (diff)
downloadsvg.js-bf7703f5915c6154937f3febf812aad6483bff45.tar.gz
svg.js-bf7703f5915c6154937f3febf812aad6483bff45.zip
make window and document exchangeable in case they are not globals alreay, make sure that init functions are chaninable
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/adopter.js3
-rw-r--r--src/utils/window.js10
2 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/adopter.js b/src/utils/adopter.js
index 88cd383..5d5d1f0 100644
--- a/src/utils/adopter.js
+++ b/src/utils/adopter.js
@@ -1,7 +1,10 @@
import { capitalize } from './utils.js'
import { ns } from '../modules/core/namespaces.js'
+import globals from '../utils/window.js'
import Base from '../types/Base.js'
+const { window, document } = globals
+
const elements = {}
export const root = Symbol('root')
diff --git a/src/utils/window.js b/src/utils/window.js
new file mode 100644
index 0000000..f44ebb9
--- /dev/null
+++ b/src/utils/window.js
@@ -0,0 +1,10 @@
+const globals = {
+ window, document
+}
+
+export default globals
+
+export function registerWindow (w) {
+ globals.window = w
+ globals.document = w.document
+}