GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Implement] Naive basic EventEmitter class by jtenner · Pull Request #18 · AssemblyScript/node

Conversation

@jtenner

@jtenner jtenner commented Jul 25, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Let me start by saying I realize how entirely dangerous this is. Currently there's no good ergonomic way to do this, and in order to implement the backbone of the Stream classes, we need something that resembles an emitter.

Current Limitations:

  1. Callback signatures must match runtime assertions
  2. EventEmitter is treated as abstract
  3. Callback parameters up to length 10
  4. callback must return void
  5. Emit still too large. Requires switch statement to determine callback argument length
  6. emit function doesn't match @types/node type arguments. It still requires explicit types
emitter.emit<A, B, C, D>(a: A, b: B, c: C, d: D); // etc.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jtenner
[Implement] Naive basic EventEmitter class
92c8656
@jtenner jtenner added the enhancement New feature or request label Jul 25, 2019
@jtenner
jtenner requested a review from dcodeIO July 25, 2019 20:44
@jtenner jtenner self-assigned this Jul 25, 2019
@jtenner
[Implement] idof<Callback<T>>() for runtime callback type checking
a99518d
@jtenner

jtenner commented Jul 25, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Now the implementation contains a groked callback type verifier that does runtime checking of callback signatures. It requires a global map that contains a set of valid signatures for each event, and is registered once per EventEmitter class extension.

Not done:

  • EventEmitter should be abstract.
  • Docs needs to be updated for this class so that others can learn how to use this class effectively
  • Wait for compiler to support variable argument lengths or inferring of argument length count
    • will be a 64bit integer with both the id and the argument length combined
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jtenner added 3 commits July 26, 2019 15:55
@jtenner
[Implement] Multiple Parameter Callbacks with
5f12802
@jtenner
[Fix] Veryify function type is void, obtain function parameter length
1ff2d68
@jtenner
[Update] experimental builtins in assemblyscript package
9da090e
@jtenner

jtenner commented Aug 13, 2019

Copy link
Copy Markdown
Contributor Author

@dcodeIO conflicts aside, what's holding this request back? I just need to fix the builtin request. Right?

Other than that, not sure how to make this better.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@dcodeIO dcodeIO Awaiting requested review from dcodeIO

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@jtenner jtenner

Labels

enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@jtenner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.