mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-02-23 14:39:32 +08:00
60 lines
2.7 KiB
YAML
60 lines
2.7 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/operators.yaml.njk
|
|
transformer: templates/operatorsMethodTransformer.js
|
|
vars:
|
|
pageId: _location
|
|
pageTitle: _location
|
|
filePath: operators/_location.yaml
|
|
env: Client Only
|
|
types: |
|
|
```
|
|
(key: string): any
|
|
```
|
|
description: |
|
|
The `_location` operator gets a value from the browser [Location](https://developer.mozilla.org/en-US/docs/Web/API/Location) interface. The Location interface represents the location (URL) of the window object it is linked to, thus can return the URL elements of the current window. It can only be used on the web-client (Not in `requests` or `connections`).
|
|
|
|
The following location properties are available.
|
|
- `basePath: string`: The application base path setting.
|
|
- `hash: string`: A string containing a '#' followed by the fragment identifier of the URL.
|
|
- `host: string`: A string containing the host, that is the hostname, a `:`, and the port of the URL.
|
|
- `hostname: string`: The domain of the URL.
|
|
- `homePageId: string`: The home page id.
|
|
- `href: string`: The entire URL string.
|
|
- `origin: string`: The canonical form of the origin of the specific location.
|
|
- `pageId: string`: The current page id.
|
|
- `pathname: string`: A string containing an initial `/`` followed by the path of the URL, not including the query string or fragment.
|
|
- `port: string`: The port number of the URL
|
|
- `protocol: string`: The protocol scheme of the URL, mostly `http:` or `https:`.
|
|
- `search: string`: A string containing a '?' followed by the parameters or "querystring" of the URL.
|
|
|
|
arguments: |
|
|
###### string
|
|
If called with a string argument, the value of the key in the `location` object is returned. If the value is defined, `null` is returned.
|
|
|
|
examples: |
|
|
###### Get the `origin` from `location`:
|
|
```yaml
|
|
_location: origin
|
|
```
|
|
Returns: The current `window.location.origin`, in this case 'https://docs.lowdefy.com'.
|
|
|
|
###### Get the `pathname` from `location`:
|
|
```yaml
|
|
_location: pathname
|
|
```
|
|
Returns: The current `window.location.pathname`, in this case '/_location'.
|