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

support emscripten build #1145

Closed
wants to merge 1 commit into from
Closed

Conversation

eagleoflqj
Copy link
Member

event_libuv.cpp)
event_sdevent.cpp)
elseif (EMSCRIPTEN)
list(APPEND FCITX_UTILS_SOURCES event_js.cpp) # implemented in fcitx5-js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like having an external file dependency.

I think we could somehow, create a stub for EventLoop and having a global factory class to allow external event loop implementation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how to achieve that with a factory.
Added the event_js.cpp, since there is nothing specific to fcitx5-js. emscripten_async_call is generic API https://emscripten.org/docs/api_reference/emscripten.h.html#c.emscripten_async_call

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without breaking the API, here's what you can do.

  1. create a stub only EventLoop that takes a EventLoopImpl as parameter.
  2. Create a global factory callback that allow external code to override the creation of EventLoopImpl.
  3. Before initialize Instance, set the factory function

In other words, use Dependency injection to make your js eventloop implementation live outside of the main repo.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@eagleoflqj
Copy link
Member Author

See fcitx-contrib/fcitx5-js#14 for downstream build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants