mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 21:27:46 +00:00
Expose NodeList and MutationRecord in global scope (#47759)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47759 Changelog: [internal] These interfaces should be available in the global scope, so this exposes them in their setup modules. Reviewed By: javache Differential Revision: D66232574 fbshipit-source-id: 191c579ffce3fb8b4b454b5c5725661ff160a46f
This commit is contained in:
parent
b2f624d054
commit
43554b5a0f
@ -8,8 +8,7 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import DOMRect from '../webapis/dom/geometry/DOMRect';
|
import {polyfillGlobal} from '../../../Libraries/Utilities/PolyfillFunctions';
|
||||||
import DOMRectReadOnly from '../webapis/dom/geometry/DOMRectReadOnly';
|
|
||||||
|
|
||||||
let initialized = false;
|
let initialized = false;
|
||||||
|
|
||||||
@ -20,9 +19,18 @@ export default function setUpDOM() {
|
|||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
|
|
||||||
// $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it
|
polyfillGlobal(
|
||||||
global.DOMRect = DOMRect;
|
'DOMRect',
|
||||||
|
() => require('../webapis/dom/geometry/DOMRect').default,
|
||||||
|
);
|
||||||
|
|
||||||
// $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it
|
polyfillGlobal(
|
||||||
global.DOMRectReadOnly = DOMRectReadOnly;
|
'DOMRectReadOnly',
|
||||||
|
() => require('../webapis/dom/geometry/DOMRectReadOnly').default,
|
||||||
|
);
|
||||||
|
|
||||||
|
polyfillGlobal(
|
||||||
|
'NodeList',
|
||||||
|
() => require('../webapis/dom/oldstylecollections/NodeList').default,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -23,4 +23,9 @@ export default function setUpMutationObserver() {
|
|||||||
'MutationObserver',
|
'MutationObserver',
|
||||||
() => require('../webapis/mutationobserver/MutationObserver').default,
|
() => require('../webapis/mutationobserver/MutationObserver').default,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
polyfillGlobal(
|
||||||
|
'MutationRecord',
|
||||||
|
() => require('../webapis/mutationobserver/MutationRecord').default,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user