-
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
120 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
_ref: | ||
path: templates/general.yaml.njk | ||
vars: | ||
pageId: plugins-actions | ||
pageTitle: Action Plugins | ||
section: Concepts | ||
filePath: concepts/plugins-actions.yaml | ||
content: | ||
- id: md1 | ||
type: MarkdownWithCode | ||
properties: | ||
content: | | ||
Actions are functions that are triggered by events in a Lowdefy app. The Lowdefy engine provides a context object to the action with the following parameters: | ||
- `globals: object`: Commonly used Javascript global objects. These are passed to the action for easier testing. | ||
- `document: object`: The browser [`window.document`](https://developer.mozilla.org/en-US/docs/Web/API/Document/Document) global variable. | ||
- `fetch: function`: The global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) Javascript method. | ||
- `window: object`: The browser [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window) global variable. | ||
- `methods: object`: | ||
- `callMethod: function`: Call the CallMethod action.. | ||
- `displayMessage: function`: Call the DisplayMessage action. | ||
- `getActions: function`: Get data from previous actions in the action chain. | ||
- `getBlockId: function`: Get the blockId of the block that triggered the event. | ||
- `getEvent: function`: Get event data from the event that triggered the action. | ||
- `getGlobal: function`: Get data from the Lowdefy global object. | ||
- `getInput: function`: Get data from the Lowdefy input object. | ||
- `getPageId: function`: Get the pageId of the block that the action is defined on. | ||
- `getRequestDetails: function`: Get data from Lowdefy requests. | ||
- `getState: function`: Get data from the Lowdefy state object. | ||
- `getUrlQuery: function`: Get data from the Lowdefy urlQuery object. | ||
- `getUser: function`: Get data from the Lowdefy user object. | ||
- `link: function`: Call the Link action. | ||
- `login: function`: Call the Login action. | ||
- `logout: function`: Call the Logout action. | ||
- `request: function`: Call the Request action. | ||
- `reset: function`: Call the Reset action. | ||
- `resetValidation: function`: Call the ResetValidation action. | ||
- `setGlobal: function`: Call the SetGlobal action. | ||
- `setState: function`: Call the SetGlobal action. | ||
- `validate: function`: Call the Validate action. | ||
- `params: any`: The `params` defined by the user in the Lowdefy configuration. Operators are evaluated before the params are passed to the action. No validation is performed on this object. | ||
The parameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
_ref: | ||
path: templates/general.yaml.njk | ||
vars: | ||
pageId: plugins-introduction | ||
pageTitle: Plugins | ||
section: Concepts | ||
filePath: concepts/plugins-introduction.yaml | ||
content: | ||
- id: md1 | ||
type: MarkdownWithCode | ||
properties: | ||
content: | | ||
Lowdefy has a plugin system that can be used to create custom blocks, connections, requests, action, operators and auth providers, adapters, callbacks and events. These plugins are written as standard npm modules, so community plugins can be published to npm, and the workspace and git protocols can be used for project specific or private plugins. Since plugins are npm packages most Javascript features and third-party npm packages can be used in plugins. | ||
## Using a plugin | ||
To use a plugin in an app, the plugin name and version should be specified in the `plugins` section of the Lowdefy config. Once the plugin is included, the types (blocks, connections, etc) defined in the plugin can be used anywhere in the app. | ||
If two plugins export types with the same type name, user defined plugins will override the default Lowdefy types, and user defined plugins will overwrite other plugins defined before them in the plugins array. | ||
###### Example | ||
```yaml | ||
plugins: | ||
# plugins installed remotely from npm | ||
- name: npm-plugin | ||
version: 1.0.0 | ||
# local plugins in pnpm monorepo | ||
- name: local-plugin | ||
version: workspace:* | ||
``` |