-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[expo-modules-core] Add stopObserving and startObserving functions #28953
Conversation
The Pull Request introduced fingerprint changes against the base commit: 7a547e4 Fingerprint diff[
{
"type": "dir",
"filePath": "../../packages/expo-audio/ios",
"reasons": [
"expoAutolinkingIos"
],
"hash": "f4a3387af1f69703875270f21efb3aa3859ed0f2"
},
{
"type": "dir",
"filePath": "../../packages/expo-modules-core",
"reasons": [
"expoAutolinkingIos",
"expoAutolinkingAndroid"
],
"hash": "a431fe056acb794845fbca538f52d61ea59f8c4f"
},
{
"type": "dir",
"filePath": "ios",
"reasons": [
"bareNativeDir"
],
"hash": "2e914129beaf1a429014be0c9c0d7d53be9fe82c"
}
] Generated by PR labeler 🤖 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to move these tests to https://github.com/expo/expo/blob/main/packages/expo-modules-core/src/__tests__/EventEmitter-test.web.ts
Also notice these silenced tests:
// TODO: Enable these tests once Web supports `startObserving` and `stopObserving`. | |
xdescribe('observing', () => { |
packages/expo-modules-core/src/__tests__/core-module/EventEmitter-test.ts
Outdated
Show resolved
Hide resolved
c74521c
to
6cd3e2b
Compare
@tsapeta I fixed a failing test case in sensors – think the current test is the expected behaviour, not sure why the expectation was different 5y ago. |
} | ||
|
||
listenerCount<EventName extends keyof TEventsMap>(eventName: EventName): number { | ||
return this.listeners?.get(eventName)?.size ?? 0; | ||
} | ||
|
||
startObserving<EventName extends keyof TEventsMap>(eventName: EventName): void {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could remove it and make it optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After testing this, I can't get the types working if I remove this stub.
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
Co-authored-by: Łukasz Kosmaty <lukasz.kosmaty@swmansion.com>
7a7152c
to
4eaede9
Compare
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
Why
Matching iOS implementation for startObserving and stopObserving functions
How
Added calling those functions to CoreModule's EventEmitter class.
Test Plan
Added unit tests.
Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).