_createThing
Create a new Thing --
Function
Anything -> _createThing
(model) -> Thing Type
- Receives
- Anything
- model
- The Model to create the new Thing from
- Produces
- The newly-created Thing.
Most of the time in Querki, you create new Things using the UI directly --
pressing a button or menu pick that creates the Thing and opens the Editor. But
some Spaces want a bit of automation: they want to be able to create a new Thing
as part of a _QLButton()
press, often with specific Properties set in specific
ways.
_createThing()
immediately creates a new Thing. The first parameter must be
model = <model name>
, saying what to create an Instance of.
You may then specify as many parameters as you like, each of which should be a
Property Setter of the form Property Name(value)
. So for example, if you had
a Whole Number Property named My Number, you would say My Number(42)
to
initially set that Property to 42. Any Type of Property except for Functions can be
set this way, and you may set any or all of the Model's Properties.
_createThing()
produces the newly-created Thing; it is common to pass this to
_edit
or _navigateTo
.
Note: the exact semantics of _createThing()
will change down the line.
While it is fine to pass the resulting Thing to another stage (using ->
), you
should not count on being able to use it in later phrases (that is, lines not
connected by ->
). This is important so that we can later support multiple
changes that happen "atomically" in a light transactional system.