Stages & Components: Canvas
What are we learning here?
Stages & Components Relations: ββββββββββββββββββββββββ
ββoptionalβββββΊβ Component Element(s) β β β
βββββββββββββββββ βββββββββββββ β ββββββββββββββββββββββββ β
β Initial Stage ββloadβββΊβ Component ββprovidesββ€ β
βββββββββββββββββ βββββββββββββ β ββββββββββββ β
β² ββat least oneββΊβ Stage(s) βββ create β β β
β ββββββ¬ββββββ
β β
β β β β β β β β β load β β β β β β β ββ
System Hierarchy:
βΊ Initial Stage
ββΊ Root Component
ββΊ Stage "main"
ββΊ Application
ββΊ Stage "main"
ββΊ Widget
ββΊ Component Element "main"
ββΊ Custom Stage
ββΊ Canvas
- How to create an component based on
Canvas
We now load another component into the stage we have created before. Here too we have to
first to create a component. This time we will create a component based on the base component class
Canvas.
A component that extends the Canvas class creates a container that provides a component element
like components based on the class Widget. The two classes offer roughly the same thing. We'll
explain the differences in more detail later.
Since we will be reusing this new component in various other scenarios, we will put all the associated files in a separate folder.
src/demo/components/loading-components/index.html
src/demo/components/loading-components/index.js
Now we we use the method load() of the returned stage object, to load our new component into this
stage:
src/demo/apps/component-basics/content.js
Start Definition Object vs Shortcut Signature
We will use here a signature of the load method which expects only one Component. This is just
a shortcut signature. The load method normally expects a so called start definition object.
This would look like:
Now you should see our Message in the stage element. We will come back later to this widget and will insert more functionality.