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

Add EventEmitter C++ bridging type #44808

Closed

Conversation

christophpurrer
Copy link
Contributor

Summary:
Adds an AsyncEventEmitter class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface

export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};

Hybrid

It is a 'hybrid' object.

1.) You addListener(handler: (T) => mixed) in JavaScript for emitted events (coming from C++, native code)
2.) You emit(...Arg) events in C++, native code (getting sent to JavaScript)

Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

Facebook:

Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 5, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424391

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 5, 2024
Summary:

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424391

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 5, 2024
Summary:

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424391

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 5, 2024
Summary:

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 5, 2024
Summary:

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391
@analysis-bot
Copy link

analysis-bot commented Jun 6, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 20,249,255 +0
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 23,454,737 +3
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 53dda9e
Branch: main

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 6, 2024
Summary:

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424391

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 6, 2024
Summary:

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424391

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 6, 2024
Summary:

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 6, 2024
Summary:

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 6, 2024
Summary:

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424391

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 6, 2024
Summary:

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 6, 2024
Summary:

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Differential Revision: D57424391
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424391

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 8, 2024
Summary:
Pull Request resolved: facebook#44808

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Reviewed By: javache

Differential Revision: D57424391
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424391

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 9, 2024
Summary:
Pull Request resolved: facebook#44808

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Reviewed By: javache

Differential Revision: D57424391
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424391

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Jun 10, 2024
Summary:
Pull Request resolved: facebook#44808

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Reviewed By: javache

Differential Revision: D57424391
Summary:
Pull Request resolved: facebook#44808

Adds an `AsyncEventEmitter` class which can be used as a property of currently C++ only Turbo Modules to send type safe data back to JavaScript.

Adding support for ObjC / Java Turbo Modules is possible, straight forward and can be added as an afterthought.

It implements this interface
```
export type EventEmitter<T> = {
  addListener(handler: (T) => mixed): EventSubscription,
};
```

## Hybrid
It is a 'hybrid' object.

1.) You `addListener(handler: (T) => mixed)` in JavaScript for emitted events (coming from C++, native code)
2.) You `emit(...Arg)` events in C++, native code (getting sent to JavaScript)

## Changelog:

[General] [Added] - Add EventEmitter C++ bridging type

## Facebook:
Apps usually create custom functionality to achieve this kind of behavior - e.g. https://www.internalfb.com/code/fbsource/[e72bd42a028a]/arvr/js/apps/RemoteDesktopCompanion/shared/turbo_modules/TMSubscription.h

Reviewed By: javache

Differential Revision: D57424391
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57424391

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 2a0a112.

Copy link

This pull request was successfully merged by @christophpurrer in 2a0a112.

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants