Граф коммитов

10 Коммитов

Автор SHA1 Сообщение Дата
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Xuan Huang d5689b959a Inherit type of queueMicrotask from Flow
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
2021-10-19 11:30:58 -07:00
Andrei Shikov 8f7e23ae44 Update format to fix CircleCI failure (#32095)
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
2021-08-26 10:30:55 -07:00
Xuan Huang a8e2415a91 Type global queueMicrotask
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
2021-08-26 01:06:44 -07:00
Xuan Huang e60ad0837e Type more globals
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
2021-08-26 01:06:44 -07:00
Xuan Huang ff4b33672a Add Flow libdefs for HermesInternalType
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
2021-08-24 00:12:21 -07:00
Xuan Huang b931aa735f Add Flow libdefs for `global`
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
2021-08-09 15:46:16 -07:00
Andres Suarez 29dce56b90 Remove requestIdleCallback/cancelIdleCallback flow lib
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
2016-12-07 13:13:39 -08:00
Tim Yung 23331df5a4 RN: Cleanup OSS JS & Flow Declarations
Reviewed By: vjeux

Differential Revision: D4210763

fbshipit-source-id: 5abaa547100b8badd13bcf311ceffc5b4098d252
2016-11-20 17:58:29 -08:00
Janic Duplessis 18394fb179 Initial implementation of requestIdleCallback on Android
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
2016-07-13 18:58:20 -07:00