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

Events #25

Closed
wants to merge 7 commits into from
Closed

Events #25

wants to merge 7 commits into from

Conversation

dakom
Copy link

@dakom dakom commented Jan 3, 2020

  • exported the make_event macro
  • added a couple more exported macros to make working with custom events easier

* exported the make_event macro
* added a couple more exported macros to make working with custom events easier
@dakom dakom mentioned this pull request Jan 3, 2020
@dakom
Copy link
Author

dakom commented Jan 8, 2020

@Pauan - thoughts?

@dakom
Copy link
Author

dakom commented Jan 15, 2020

actually, using the paste crate - the following is even nicer:

macro_rules! my_make_event {
    ($type:literal, $name:ident) => {
        paste::item! {
            make_custom_event_serde!($type, [<$name Event>], $name);
        }
    }
}

Example, will create both AddTodoEvent and impl what's needed for AddTodo - but user only specifies AddTodo and the literal:

#[derive(Deserialize)]
pub struct AddTodo {
    pub label: String 
}
my_make_event!("add-todo", AddTodo);

@Pauan
Copy link
Owner

Pauan commented Jan 16, 2020

I think it's a bit too early to commit to make_event, especially because I want to make some changes to the event system and also fold it into gloo.

@Pauan
Copy link
Owner

Pauan commented Jan 16, 2020

(paste looks amazing though, I've wanted that functionality before, so thanks for pointing that out)

@dakom
Copy link
Author

dakom commented Jan 16, 2020

okay... currently I'm relying on this PR for experimental tests and such - so will build against my fork for now... but keeping 👀 on this for when you settle on an event api :)

@dakom
Copy link
Author

dakom commented Aug 4, 2020

I'm going to close this in favor of moving it to https://github.com/dakom/dominator-helpers

However, the event macros in dominator-helpers will be broken until make_event! itself is pub

(personally, I'm okay with that since I'm no longer using those event macros in production and in a pinch one could make a fork of dominator with that one change if really necessary).

Will open a new issue to track that though

@dakom dakom closed this Aug 4, 2020
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.

None yet

2 participants