You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/scene_lifecycle.md
-34Lines changed: 0 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,40 +33,6 @@ At some point, depending on your target processor, you will start to have perfor
33
33
34
34
The good news is that as you switch away to different root scenes, all the old components are automatically cleaned up for you.
35
35
36
-
37
-
## App Supervised Scenes
38
-
39
-
If you have a component scene that is used by may other scenes, or even in multiple ViewPorts at the same time, you can save memory and reduce load by supervising those scenes yourself.
40
-
41
-
To do this, create a supervisor in your application and start one or more scenes under it. You can give these scenes names, which is how you will reference them from your graphs.
When you build your graphs, you can now use this statically supervised scene directly through the `scene_ref/3` helper in `Scenic.Primitives`.
60
-
61
-
@graph Graph.build()
62
-
|> scene_ref(:app_scene, translate: {300, 300})
63
-
|> scene_ref(:clock, translate: {400, 20})
64
-
65
-
The main trade-off you make when you supervise a scene yourself is that the scene no longer knows which ViewPort it is running in. It could be several at the same time! You will not be able to use functions like `ViewPort.set_root` from these scenes.
66
-
67
-
The second trade-off is that if the root scene _doesn't_ reference a scene you are supervising yourself, then that scene is still taking up memory in both the scene and the driver even though it isn't being drawn.
68
-
69
-
70
36
## What to read next?
71
37
72
38
If you are exploring Scenic, then you should read the [Graph Overview](overview_graph.html) next.
0 commit comments