easy-scratch/doc/scratch-vm/Cloud.html

1510 lines
82 KiB
HTML
Raw Normal View History

2025-02-12 12:27:32 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cloud - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="-_StackFrame.html">_StackFrame</a><ul class='methods'><li data-type='method'><a href="-_StackFrame.html#.create">create</a></li><li data-type='method'><a href="-_StackFrame.html#.release">release</a></li><li data-type='method'><a href="-_StackFrame.html#reset">reset</a></li><li data-type='method'><a href="-_StackFrame.html#reuse">reuse</a></li></ul></li><li><a href="BLE.html">BLE</a><ul class='methods'><li data-type='method'><a href="BLE.html#connectPeripheral">connectPeripheral</a></li><li data-type='method'><a href="BLE.html#didReceiveCall">didReceiveCall</a></li><li data-type='method'><a href="BLE.html#disconnect">disconnect</a></li><li data-type='method'><a href="BLE.html#handleDisconnectError">handleDisconnectError</a></li><li data-type='method'><a href="BLE.html#isConnected">isConnected</a></li><li data-type='method'><a href="BLE.html#read">read</a></li><li data-type='method'><a href="BLE.html#requestPeripheral">requestPeripheral</a></li><li data-type='method'><a href="BLE.html#startNotifications">startNotifications</a></li><li data-type='method'><a href="BLE.html#write">write</a></li></ul></li><li><a href="BlockCached.html">BlockCached</a></li><li><a href="Blocks.html">Blocks</a><ul class='methods'><li data-type='method'><a href="Blocks.html#_addScript">_addScript</a></li><li data-type='method'><a href="Blocks.html#_deleteScript">_deleteScript</a></li><li data-type='method'><a href="Blocks.html#_getBackdropField">_getBackdropField</a></li><li data-type='method'><a href="Blocks.html#_getBlockParams">_getBlockParams</a></li><li data-type='method'><a href="Blocks.html#_getCostumeField">_getCostumeField</a></li><li data-type='method'><a href="Blocks.html#_getCustomBlockInternal">_getCustomBlockInternal</a></li><li data-type='method'><a href="Blocks.html#_getSoundField">_getSoundField</a></li><li data-type='method'><a href="Blocks.html#_getSpriteField">_getSpriteField</a></li><li data-type='method'><a href="Blocks.html#blocklyListen">blocklyListen</a></li><li data-type='method'><a href="Blocks.html#blockToXML">blockToXML</a></li><li data-type='method'><a href="Blocks.html#changeBlock">changeBlock</a></li><li data-type='method'><a href="Blocks.html#createBlock">createBlock</a></li><li data-type='method'><a href="Blocks.html#deleteBlock">deleteBlock</a></li><li data-type='method'><a href="Blocks.html#emitProjectChanged">emitProjectChanged</a></li><li data-type='method'><a href="Blocks.html#getAllVariableAndListReferences">getAllVariableAndListReferences</a></li><li data-type='method'><a href="Blocks.html#getBlock">getBlock</a></li><li data-type='method'><a href="Blocks.html#getBranch">getBranch</a></li><li data-type='method'><a href="Blocks.html#getFields">getFields</a></li><li data-type='method'><a href="Blocks.html#getInputs">getInputs</a></li><li data-type='method'><a href="Blocks.html#getMutation">getMutation</a></li><li data-type='method'><a href="Blocks.html#getNextBlock">getNextBlock</a></li><li data-type='method'><a href="Blocks.html#getOpcode">getOpcode</a></li><li data-type='method'><a href="Blocks.html#getProcedureDefinition">getProcedureDefinition</a></li><li data-type='method'><a href="Blocks.html#getProcedureParamNamesAndIds">getProcedureParamNamesAndIds</a></li><li data-type='method'><a href="Blocks.html#getProcedureParamNamesIdsAndDefaults">getProcedureParamNamesIdsAndDefaults</a></li><li data-type='method'><a href="Blocks.html#getScripts">getScripts</a></li><li data-type='method'><a href="Blocks.html#getTopLevelScript">getTopLevelScript</a></li><li data-type='method'><a href="Blocks.html#moveBlock">moveBlock</a></li><li data-type='method'><a href="Blocks.html#mutationToXML">mutationToXML</a></li><li data-type='method'><a href="Blocks.html#resetCache">resetCache</a></li><li data-type='method'><a href="Blocks.html#runAllMonitored">runAllMonitored</a></li><li data-type='method'><a href="Blocks.html#toXML">toXML</a></li><li data-type='method'><a href="Blocks.html#updateAssetName">updateAssetName</a></li><li data-type='method'><a href
</nav>
<div id="main">
<h1 class="page-title">Cloud</h1>
<section>
<header>
<h2>
Cloud
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Cloud"><span class="type-signature"></span>new Cloud<span class="signature">(runtime)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Cloud IO Device responsible for sending and receiving messages from
cloud provider (mananging the cloud server connection) and interacting
with cloud variables in the current project.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>runtime</code></td>
<td class="type">
<span class="param-type"><a href="Runtime.html">Runtime</a></span>
</td>
<td class="description last"><p>The runtime context for this cloud io device.</p></td>
</tr>
</tbody>
</table>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="provider"><span class="type-signature">(nullable) </span>provider<span class="type-signature"> :<a href="global.html#CloudProvider">CloudProvider</a></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Reference to the cloud data provider, responsible for mananging
the web socket connection to the cloud data server.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="global.html#CloudProvider">CloudProvider</a></span>
</li>
</ul>
<h4 class="name" id="runtime"><span class="type-signature">(non-null) </span>runtime<span class="type-signature"> :<a href="Runtime.html">Runtime</a></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Reference to the runtime that owns this cloud io device.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="Runtime.html">Runtime</a></span>
</li>
</ul>
<h4 class="name" id="stage"><span class="type-signature">(nullable) </span>stage<span class="type-signature"> :<a href="Target.html">Target</a></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Reference to the stage target which owns the cloud variables
in the project.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="Target.html">Target</a></span>
</li>
</ul>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="clear"><span class="type-signature"></span>clear<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Request the cloud data provider to close the web socket connection and
clear this io device of references to the cloud data provider and the
stage.</p>
</div>
<h4 class="name" id="postData"><span class="type-signature"></span>postData<span class="signature">(data)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Handle incoming data to this io device.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type"><a href="global.html#CloudIOData">CloudIOData</a></span>
</td>
<td class="description last"><p>The <a href="global.html#CloudIOData">CloudIOData</a> object to process</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="requestDeleteVariable"><span class="type-signature"></span>requestDeleteVariable<span class="signature">(name)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Request the cloud data provider to delete the variable with the given name
Does nothing if this io device does not have a provider set.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The name of the variable to delete</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="requestRenameVariable"><span class="type-signature"></span>requestRenameVariable<span class="signature">(oldName, newName)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Request the cloud data provider to rename the variable with the given name
to the given new name. Does nothing if this io device does not have a provider set.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>oldName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The name of the variable to rename</p></td>
</tr>
<tr>
<td class="name"><code>newName</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">number</span>
</td>
<td class="description last"><p>The new name for the variable</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="requestUpdateVariable"><span class="type-signature"></span>requestUpdateVariable<span class="signature">(name, value)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Request the cloud data provider to update the given variable with
the given value. Does nothing if this io device does not have a provider set.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>The name of the variable to update</p></td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">number</span>
</td>
<td class="description last"><p>The value to update the variable with</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="setProvider"><span class="type-signature"></span>setProvider<span class="signature">(provider)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Set a reference to the cloud data provider.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>provider</code></td>
<td class="type">
<span class="param-type"><a href="global.html#CloudProvider">CloudProvider</a></span>
</td>
<td class="description last"><p>The cloud data provider</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="setStage"><span class="type-signature"></span>setStage<span class="signature">(stage)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Set a reference to the stage target which owns the
cloud variables in the project.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>stage</code></td>
<td class="type">
<span class="param-type"><a href="Target.html">Target</a></span>
</td>
<td class="description last"><p>The stage target</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="updateCloudVariable"><span class="type-signature"></span>updateCloudVariable<span class="signature">(varUpdate)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Update a cloud variable in the runtime based on the message received
from the cloud provider.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>varUpdate</code></td>
<td class="type">
<span class="param-type">VarData</span>
</td>
<td class="description last"><p>A VarData object describing
a cloud variable update received from the cloud data provider.</p></td>
</tr>
</tbody>
</table>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
</body>
</html>