-
Notifications
You must be signed in to change notification settings - Fork 84
Special cloud behaviours
Sean edited this page May 1, 2021
·
7 revisions
When the "Give certain cloud variables special behaviours depending on the name?" option is checked, an HTMLified project will react to changes to cloud variables.
WARNING: There is no prefix for these cloud variable names, so I may add a behaviour in the future that conflicts with an existing cloud variable in your project.
| Cloud variable name | Description | Added |
|---|---|---|
☁ eval |
When you set ☁ eval to some JavaScript code, the project will run it, and the result will be stored in either ☁ eval output or ☁ eval error. If the code returns a Promise, the project will first wait for it to resolve. |
2020-06-01 |
☁ eval output |
The return value from the JavaScript code will be stored in ☁ eval output, if it exists. |
2020-06-01 |
☁ eval error |
If evaluating the JavaScript from ☁ eval resulted in an error, the error message will be stored in this cloud variable. If this cloud variable doesn't exist, nothing will happen. |
2020-06-01 |
☁ open link |
When you set ☁ open link to a URL, the project will try to open a new tab with that URL. Pop-up blockers might prevent this from happening, though. |
2021-02-07 |
☁ redirect |
When you set ☁ redirect to a URL, the project will be redirected to that URL (like clicking a link). However, this means your project can no longer run. |
2021-02-07 |
☁ set clipboard |
When you set ☁ set clipboard, it'll copy its value to the user's clipboard. However, browsers are pretty stringent on websites manipulating the clipboard, and if something fails, an error will be stored in ☁ eval error if the variable exists. Generally, copying in response to a click, or simply using a list, has a greater chance of succeeding. On Chrome, this only works on HTTPS or localhost sites. |
2021-02-07 |
☁ pasted |
Contains the last pasted text from the user. | 2021-03-16 |
☁ set server ip |
Setting ☁ set server ip will change the cloud server IP. |
2021-02-07 |
☁ url |
Contains the current URL of the web page. | 2021-03-16 |
☁ local storage ... |
If you're using a custom cloud server, variables whose names start with ☁ local storage will be saved in localStorage. |
2020-06-01 |
☁ username |
When set, it changes the value reported by the username block. | 2021-03-16 |
| Other | If you're using a cloud server, all other cloud variables will be saved in the cloud. Otherwise, the cloud variables will be saved in localStorage. | 2020-06-01 |
There is also a global setCloud function that you can use. For example,
setCloud('high score', 10)will set the cloud variable ☁ high score to 10.