Skip to content

Questions about patterns #2566

Answered by mainrs
hanxiaohuivc asked this question in Q&A
Discussion options

You must be logged in to vote

Patterns just describe different ways about the way your JS view communicates with the Rust code. And depending on the type of application you want to build, you can choose a pattern.

For example one pattern provides methods exposes to JS that are implemented by default in Rust (file system access for example). If your application needs to read a file, you can use that api to do it.

I mostly go with the lockdown pattern. It removes all default APIs. If you need access to files you have to write a custom Rust command yourself. In my case it's almost always a database access that returns the data in some way. That way you can restrict what the JS code can do.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hanxiaohuivc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants