Differences
This shows you the differences between two versions of the page.
Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
blocks:app-note:interacting-from-a-custom-web-page [2021-08-31 14:54] max Fixed a issue in pub-sub-peer.js |
blocks:app-note:interacting-from-a-custom-web-page [2023-08-01 21:07] (current) admin [Installation] |
===== Installation ===== | ===== Installation ===== |
| |
You need a computer with a running blocks server and a web browser to run this application note. Here's the {{ :blocks:app-note:custom-web-page:interactingfromcustomwebpage_v2.zip| Blocks root}} for this application note. See the the [[https://int.pixilab.se/docs/blocks/app-note/start|general setup section]] for details on downloading and installation. Once that general setup is done, follow these steps to run the application note: | You need a computer with a running blocks server and a web browser to run this application note. Here's the {{ :blocks:app-note:custom-web-page:interactingfromcustomwebpage_v2.zip| Blocks root}} for this application note. See the the [[blocks:app-note:start|general setup section]] for details on downloading and installation. Once that general setup is done, follow these steps to run the application note: |
| |
- Start Blocks. | - Start Blocks. |
=== pubSubPeer.add === | === pubSubPeer.add === |
| |
This is similar to the //set// function, and takes the same two parameters. However, it may only be used with numeric values. You can use it to increase or decrease (by passing a negative value) a numeric property, such as a volume value. This is often simpler for such incremental adjustments than maintaining a subscription to the value in order to do the calculation on the client side based on the current value and then using the //set// function to change the value. | This is similar to the //set// function, and takes the same two parameters. When used with a numeric property, the value you specify will be added to the current value. Pass a negative value to subtract. When used with a string property, the value will be //appended// (concatenated) to the current string value. |
| |
| The //add// methid is often simpler for such incremental adjustments than maintaining a subscription to the value in order to do the calculation on the client side based on the current value and then using the //set// function to change the value. |
| |
| |
=== pubSubPeer.unsubscribe === | === pubSubPeer.unsubscribe === |
| |
This function allows you to terminate any value subscription initiated by the //subscribe// fuynction if you're no longer interested in changes of a property. It takes the following parameters: | This function allows you to terminate any value subscription initiated by the //subscribe// function if you're no longer interested in changes of a property. It takes the following parameters: |
| |
- The full path to the property to subscribe to (see above). | - The full path to the property to subscribe to (see above). |