Skip to content
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

Merged
merged 8 commits into from
Jun 7, 2024

Conversation

aleqsio
Copy link
Contributor

@aleqsio aleqsio commented May 17, 2024

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

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label May 17, 2024
@expo-bot
Copy link
Collaborator

expo-bot commented May 17, 2024

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 🤖

@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels May 18, 2024
Copy link
Member

@tsapeta tsapeta left a 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', () => {

@aleqsio aleqsio force-pushed the @aleqsio/add-stop-start-observing-web branch from c74521c to 6cd3e2b Compare May 21, 2024 14:18
@expo-bot expo-bot added bot: suggestions ExpoBot has some suggestions and removed bot: passed checks ExpoBot has nothing to complain about labels May 22, 2024
@aleqsio
Copy link
Contributor Author

aleqsio commented May 22, 2024

@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.

@aleqsio aleqsio requested a review from tsapeta May 28, 2024 13:44
}

listenerCount<EventName extends keyof TEventsMap>(eventName: EventName): number {
return this.listeners?.get(eventName)?.size ?? 0;
}

startObserving<EventName extends keyof TEventsMap>(eventName: EventName): void {}
Copy link
Contributor Author

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

Copy link
Contributor Author

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.

@aleqsio aleqsio force-pushed the @aleqsio/add-stop-start-observing-web branch from 7a7152c to 4eaede9 Compare June 6, 2024 16:24
aleqsio and others added 2 commits June 7, 2024 12:23
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
@expo expo deleted a comment from expo-bot Jun 7, 2024
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Jun 7, 2024
@aleqsio aleqsio merged commit e731dc1 into main Jun 7, 2024
18 of 19 checks passed
@aleqsio aleqsio deleted the @aleqsio/add-stop-start-observing-web branch June 7, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: fingerprint changed bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants