mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-02-23 14:39:32 +08:00
78 lines
2.4 KiB
YAML
78 lines
2.4 KiB
YAML
# Copyright 2020-2021 Lowdefy, Inc
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
_ref:
|
|
path: templates/actions.yaml.njk
|
|
vars:
|
|
pageId: SetGlobal
|
|
pageTitle: SetGlobal
|
|
types: |
|
|
```
|
|
(toSet: object): void
|
|
```
|
|
description: |
|
|
The `SetGlobal` action sets values to the `global` object. It takes an object as parameters, and sets each of those values to the `global` object.
|
|
This is useful if you need to set a value that needs to be available across multiple pages in the app, like the id of a currently selected
|
|
object. `SetGlobal` works just like `SetState`, except it sets to the `global` object and not `state`.
|
|
params: |
|
|
###### object
|
|
Object with key value pairs to set in `global`.
|
|
examples: |
|
|
###### Set a single value to global:
|
|
```yaml
|
|
- id: set_selected_company
|
|
type: SetGlobal
|
|
params:
|
|
selected_selected_company:
|
|
_state: company.id
|
|
```
|
|
|
|
###### Set multiple values to state:
|
|
```yaml
|
|
- id: multiple_values
|
|
type: SetGlobal
|
|
params:
|
|
firstName: Monica
|
|
lastName: Geller
|
|
address:
|
|
street: 90 Bedford St
|
|
city: New York
|
|
zipCode: '10014'
|
|
country: US
|
|
friends:
|
|
- Ross Geller
|
|
- Rachel Green
|
|
- Chandler Bing
|
|
- Phoebe Buffay
|
|
- Joey Tribbiani
|
|
```
|
|
|
|
###### Using dot notation:
|
|
```yaml
|
|
- id: dot_notation
|
|
type: SetGlobal
|
|
params:
|
|
firstName: Monica
|
|
lastName: Geller
|
|
address.street: 90 Bedford St
|
|
address.city: New York
|
|
address.zipCode: '10014'
|
|
address.country: US
|
|
friends.0: Ross Geller
|
|
friends.1: Rachel Green
|
|
friends.2: Chandler Bing
|
|
friends.3: Phoebe Buffay
|
|
friends.5: Joey Tribbiani
|
|
```
|