Skip to content
Snippets Groups Projects
Commit dc7db4c2 authored by Karishma Chadha's avatar Karishma Chadha
Browse files

Add docs and make capitalization/naming of props consistent.

parent e0a1fdfa
No related branches found
No related tags found
No related merge requests found
...@@ -2,9 +2,19 @@ import log from './log.js'; ...@@ -2,9 +2,19 @@ import log from './log.js';
class CloudProvider { class CloudProvider {
constructor (cloudHost, vm, user, projectId) { /**
* A cloud data provider which creates and manages a web socket connection
* to the Scratch cloud data server. This provider is responsible for
* interfacing with the VM's cloud io device.
* @param {string} cloudHost The url for the cloud data server
* @param {VirtualMachine} vm The Scratch virtual machine to interface with
* @param {string} username The username to associate cloud data updates with
* @param {string} projectId The id associated with the project containing
* cloud data.
*/
constructor (cloudHost, vm, username, projectId) {
this.vm = vm; this.vm = vm;
this.username = user; this.username = username;
this.projectId = projectId; this.projectId = projectId;
// Open a websocket connection to the clouddata server // Open a websocket connection to the clouddata server
...@@ -36,9 +46,7 @@ class CloudProvider { ...@@ -36,9 +46,7 @@ class CloudProvider {
const message = JSON.parse(messageString); const message = JSON.parse(messageString);
if (message.method === 'set') { if (message.method === 'set') {
const varData = { const varData = {
projectId: this.projectId,
varUpdate: { varUpdate: {
projectId: message.project_id,
name: message.name, name: message.name,
value: message.value value: message.value
} }
......
...@@ -74,7 +74,7 @@ const vmManagerHOC = function (WrappedComponent) { ...@@ -74,7 +74,7 @@ const vmManagerHOC = function (WrappedComponent) {
onLoadedProject: onLoadedProjectProp, onLoadedProject: onLoadedProjectProp,
projectData, projectData,
projectId, projectId,
userName, username,
/* eslint-enable no-unused-vars */ /* eslint-enable no-unused-vars */
isLoadingWithId: isLoadingWithIdProp, isLoadingWithId: isLoadingWithIdProp,
vm, vm,
...@@ -100,7 +100,7 @@ const vmManagerHOC = function (WrappedComponent) { ...@@ -100,7 +100,7 @@ const vmManagerHOC = function (WrappedComponent) {
onLoadedProject: PropTypes.func, onLoadedProject: PropTypes.func,
projectData: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), projectData: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
projectId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), projectId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
userName: PropTypes.string, username: PropTypes.string,
vm: PropTypes.instanceOf(VM).isRequired vm: PropTypes.instanceOf(VM).isRequired
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment