-
Notifications
You must be signed in to change notification settings - Fork 80
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
feat: allow using Formatter::Function from WASM #67
base: main
Are you sure you want to change the base?
Conversation
2926354
to
9c8d993
Compare
I've updated the PR so that it's possible to express a function that would work both in a SSR and WASM context (via |
… both wasm and non-wasm targets
9c8d993
to
a756a0e
Compare
This doesn't seem to compile on wasm because the Also, its probably worth adding this from impl: #[cfg(target_arch = "wasm32")]
impl From<web_sys::js_sys::Function> for FormatterFunction {
fn from(f: web_sys::js_sys::Function) -> Self {
FormatterFunction { value: f }
}
} |
@sangelxyz you are using this PR in a leptos project, right? So you are able to use this in a wasm context? |
Yes commit 67 does work. I uploaded a leptos SSR example here. you can see it in use You do need a feature tag in order for it to compile in an ssr/wasm context.. |
@sangelxyz i took a look at your repo, and the charming dependency is specified as a path. I'm thinking your local repo is not up to date with this PR. Are you able to share the FormatterFunction struct definition in your local charming clone here just to clarify it's the same with the latest in this PR |
We can create functions directly using
js_sys::Function::new_with_args
for example when using WASM. Fixes #66