Using proxies in Nue.js #41
Answered
by
tipiirai
hichem-dahi
asked this question in
Q&A
-
Can someone explain what purpose this Proxy object serves in the code?
|
Beta Was this translation helpful? Give feedback.
Answered by
tipiirai
Sep 22, 2023
Replies: 1 comment 2 replies
-
That proxy is a vital part of Nue JS. An expression like |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
{ title }
expression gets compiled to a function like this(_) => _.title
which is called by Nue JS on the client side. The_
variable is the proxy instance we talked about. The compiler is here:https://github.com/nuejs/nuejs/blob/master/ssr/compile.js
And here is the exact spot where a variable is prefixed with the context:
https://github.com/nuejs/nuejs/blob/master/ssr/expr.js#L25