lowdefy/packages/docs/actions/CallMethod.yaml

58 lines
1.6 KiB
YAML
Raw Normal View History

2021-01-19 18:36:43 +08:00
# 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.
2021-01-13 23:21:27 +08:00
_ref:
2021-01-28 18:51:02 +08:00
path: templates/actions.yaml.njk
2021-01-13 23:21:27 +08:00
vars:
pageId: CallMethod
pageTitle: CallMethod
2021-02-12 01:09:10 +08:00
filePath: actions/CallMethod.yaml
2021-01-28 18:51:02 +08:00
types: |
```
(params: {
blockId: string,
method: string,
args?: any[]
2021-01-28 18:51:02 +08:00
}): void
```
description: |
The `CallMethod` action is used to call a method defined by another block.
params: |
###### object
- `blockId: string`: __Required__ - The id of the block.
- `method: string`: __Required__ - The name of the method that should be called.
- `args: any[]`: The array of positional arguments with which the method should be called.
2021-01-28 18:51:02 +08:00
examples: |
###### Open a modal:
```yaml
- id: toggle_modal
type: CallMethod
params:
blockId: my_modal
method: toggleOpen
```
###### Display a message with args:
```yaml
- id: display_message
type: CallMethod
params:
blockId: my_message
method: open
args:
- content: Hello
duration: 4
2021-01-28 18:51:02 +08:00
```