mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 21:20:50 +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
|
||||
*/
|
||||
|
||||
import DOMRect from '../webapis/dom/geometry/DOMRect';
|
||||
import DOMRectReadOnly from '../webapis/dom/geometry/DOMRectReadOnly';
|
||||
import {polyfillGlobal} from '../../../Libraries/Utilities/PolyfillFunctions';
|
||||
|
||||
let initialized = false;
|
||||
|
||||
@ -20,9 +19,18 @@ export default function setUpDOM() {
|
||||
|
||||
initialized = true;
|
||||
|
||||
// $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it
|
||||
global.DOMRect = DOMRect;
|
||||
polyfillGlobal(
|
||||
'DOMRect',
|
||||
() => require('../webapis/dom/geometry/DOMRect').default,
|
||||
);
|
||||
|
||||
// $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it
|
||||
global.DOMRectReadOnly = DOMRectReadOnly;
|
||||
polyfillGlobal(
|
||||
'DOMRectReadOnly',
|
||||
() => require('../webapis/dom/geometry/DOMRectReadOnly').default,
|
||||
);
|
||||
|
||||
polyfillGlobal(
|
||||
'NodeList',
|
||||
() => require('../webapis/dom/oldstylecollections/NodeList').default,
|
||||
);
|
||||
}
|
||||
|
@ -23,4 +23,9 @@ export default function setUpMutationObserver() {
|
||||
'MutationObserver',
|
||||
() => require('../webapis/mutationobserver/MutationObserver').default,
|
||||
);
|
||||
|
||||
polyfillGlobal(
|
||||
'MutationRecord',
|
||||
() => require('../webapis/mutationobserver/MutationRecord').default,
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user