Summary:
Changelog: [Internal]
Now that Flow releases include a type def of `queueMicrotask`,
we can just inherit it from Flow
Reviewed By: yungsters
Differential Revision: D31754482
fbshipit-source-id: f42f8ec955f898d7a964ff85b6061d4840590d4d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32095
Found by running `yarn run prettier` and including relevant files
Changelog:
[Internal] Fix formatting of `global.js`
Reviewed By: cortinico
Differential Revision: D30573273
fbshipit-source-id: 94854d3d3178533ad8a6323006eaca279a931fa7
Summary:
Changelog: [Internal]
This diff
- add `queueMicrotask` to eslint and metro so it's globally available.
- add `queueMicrotask` to the global libdef of react native so the type
is available to `global.queueMicrotask` (which is common) as well.
Reviewed By: yungsters
Differential Revision: D30158144
fbshipit-source-id: 00a62193b838745c91179ff1e983636200560690
Summary:
Changelog: [Internal]
This diff add types to some of the common globals so uses of
them through `global` are now typed.
All the globals are marked as read-only for their intented uses.
However, some of them do have write cites (mostly are in tests to
deliberately set up a special test environment). Those write cites
are considered as "necessary evil" and annotated as `FlowFixMe`.
Reviewed By: yungsters
Differential Revision: D30158145
fbshipit-source-id: 93a99063361a4b7a1e33d9fc97a661be30a4d8f9
Summary:
Changelog: [Internal]
This diff add a flow libdefs for the `HermesInternalType` to type
`HermesInternal` as the first accurately typed `global` property,
and filled all the type holes.
Reviewed By: yungsters
Differential Revision: D29986749
fbshipit-source-id: a94be7919f989b5085f6b264e55145a85020fea9
Summary:
Changelog: [Internal]
Currently, `global` is typed as `any` and any `global` properties
accesses are untyped. This diff add a flow libdefs for the `global`
object as a start point.
Reviewed By: yungsters
Differential Revision: D30000895
fbshipit-source-id: ab6988d01921a3c2a3434b534b2f69083570fb6d
Summary: As of flow 0.36.0, `requestIdleCallback` and `cancelIdleCallback` are part of the builtin lib defs. https://github.com/facebook/flow/pull/2800
Reviewed By: yungsters
Differential Revision: D4280306
fbshipit-source-id: 30328675c7dbfe12f603321f1196c87800a19ba8
Summary:
This is a follow up of the work by brentvatne in #5052. This addresses the feedback by astreet.
- Uses ReactChoreographer with a new callback type
- Callback dispatch logic moved to JS
- Only calls into JS when needed, when there are pending callbacks, it even removes the Choreographer listener when no JS context listen for idle events.
** Test plan **
Tested by running a background task that burns all remaining idle time (see new UIExplorer example) and made sure that UI and JS fps stayed near 60 on a real device (Nexus 6) with dev mode disabled. Also tried adding a JS driven animation and it stayed smooth.
Tested that native only calls into JS when there are pending idle callbacks.
Also tested that timers are executed before idle callback.
```
requestIdleCallback(() => console.log(1));
setTimeout(() => console.log(2), 100);
burnCPU(1000);
// 2
// 1
```
I did *not* test with webworkers but it should work as I'm using executor tokens.
Closes https://github.com/facebook/react-native/pull/8569
Differential Revision: D3558869
Pulled By: astreet
fbshipit-source-id: 61fa82eb26001d2b8c2ea69c35bf3eb5ce5454ba