question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Codegen for events

See original GitHub issue

Writing events is currently very verbose, requiring lots of boilerplate code.

Additionally, many events simply take the form

for (Callback callback : callbacks) {
    callback.onEvent(...);
}

See also this comment in EventFactory

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
LemmaEOFcommented, Feb 5, 2021

I think whatever form this takes should be optional - there are scenarios where you’d want something more complex than a forEach, like early-exit.

0reactions
liachcommented, Jan 30, 2021

An alternative I think of would be a factory method to generate Function<T[], T>, possibly when given Class<T> and/or the method to dispatch, either as a Method or a MethodHandle. However, it is still restricted, since not all callbacks just call sub-callbacks; some have early halt or tristate merging, so the usefulness isn’t as much as we would assume.

In addition, we need to check the performance of that Function to make sure it’s not slower than the current lambda meta call site. Somewhere it says Proxy makes spring calls about 10% to 20% slower than direct interface calls.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Codegen for TurboModules does not allow for Events to be ...
I am working on an app that requires a native module to be able to emit random events. In my case I am...
Read more >
CodeGen International - Events - Facebook
Technology Opportunity for Travel Agents Registration. OCT28. 4:30 PM UTC+05:30. Online event ; Planting 1200 Native trees at Pansalthenna, Ankumbura. NOV30. 7: ...
Read more >
graphql-codegen-events - npm
Generate event types for graphql codegen plugin. Latest version: 0.0.18, last published: a year ago. Start using graphql-codegen-events in your project by ...
Read more >
Code Generation for Event-B - Ethz
Abstract. We present an approach to generating program code from Event-B models that is correct-by-construction. Correctness is guaranteed by the com-.
Read more >
1033100 - codegen for events that have an init dictionary member ...
I just tried using the event codegen for CSSFontFaceLoadEvent in bug 1028497, where the init dictionary has a member with a sequence type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found