Genie Discord forum

Author AvatarAnarchist Wolf
7/26/2023, 5:00:51 PM

Hello, I am trying to share different model variables to different route pages.

Say that i have a variable that is plot data on the main "/" page but i also want to use that data on a different route like "/plotpage". Currently i have the routes setup on the main page like....

module LaserPage

@page("/", ui)
#model = Model |> init |> handlers
route("/") do
  global model = @init
  #html(ui(model), context = @__MODULE__)
  page(model, ui()) |> html

module PrelimPage

Server.up(async= true)

Which just allow for different pages to be pulled up on the same IP but the variables are not shared.

In the laserpage.jl for example this is how it is routed

model = Model |> init |> handlers
LaserModel = model
route("/laser") do
  global LaserModel
  html(ui(LaserModel), context = @__MODULE__)

Which is great when i dont need variables to be global across multiple pages.


Author Avatarabhimanyuaryan
8/5/2023, 1:16:30 PM

You can use same model for multiple pages?

Author AvatarAnarchist Wolf
8/7/2023, 3:36:48 AM

I can use the same model but I want an observable written on one page to be available on another page with a different model.