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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃摉] onLoad$ img cookbook #6246

Open
PatrickJS opened this issue May 6, 2024 · 0 comments
Open

[馃摉] onLoad$ img cookbook #6246

PatrickJS opened this issue May 6, 2024 · 0 comments
Labels
COMP: docs Improvements or additions to documentation STATUS-1: needs triage New issue which needs to be triaged

Comments

@PatrickJS
Copy link
Member

PatrickJS commented May 6, 2024

Suggestion

document a better way to detect onLoad for images
#4481

const imgRef = useSignal<HTMLImageElement>();
useVisibleTask$(()=> { 
  imgRef.value!.decode().then(() => { 
    console.log('loaded and ready!');
  });
});
    
// other logic etc
return (
  <section>
    <img ref=[imgRef} srf="some-source.png" height={200} width={200} />
  </section>
);
@PatrickJS PatrickJS added COMP: docs Improvements or additions to documentation STATUS-1: needs triage New issue which needs to be triaged labels May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP: docs Improvements or additions to documentation STATUS-1: needs triage New issue which needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant