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

If I use 'rand' library anywhere before rendering, it renders nothing on the website #406

Open
ydl1991 opened this issue Aug 4, 2020 · 2 comments

Comments

@ydl1991
Copy link

ydl1991 commented Aug 4, 2020

anyone has tried this or knows why?

I tried to render some objects with random colors, and I created a vec of colors where I store the random color I generated using rng.gen_range() for rgb.

but if I try to render, it just shows white pages.

@teymour-aldridge
Copy link

You might need to configure some feature flags to get it to use builtin browser APIs rather than some other method which isn't supported by Wasm in the browser.

@iyakushev
Copy link

iyakushev commented Aug 30, 2020

@ydl1991 Check out the console log in the browser. It will probably tell you that it had encountered a panic which is related to the thread_rng or target is not supported.
Specifing this feature in the TOML [dependencies] section has helped me. Hope it helps.

rand = {version = "0.7.3", features = ['stdweb']}

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

No branches or pull requests

3 participants