Skip to content
This repository was archived by the owner on Nov 22, 2021. It is now read-only.

Commit e4be46d

Browse files
author
Ke, Mingze
committed
Fixed for node
1 parent 5843a13 commit e4be46d

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

Diff for: blocks/webduino.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,8 @@ Blockly.Blocks['smart_ready'] = {
10011001
.setCheck("String")
10021002
.appendField(Blockly.Msg.WEBDUINO_SMART)
10031003
.appendField(new Blockly.FieldDropdown([
1004-
[Blockly.Msg.WEBDUINO_BOARD_WEBSOCKET, "4"]
1004+
[Blockly.Msg.WEBDUINO_BOARD_WEBSOCKET, "4"],
1005+
[Blockly.Msg.WEBDUINO_BOARD_WIFI, "1"]
10051006
]), "type_")
10061007
.appendField(":");
10071008
this.appendDummyInput()

Diff for: code.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Code.checkDeviceOnline = function (device) {
371371

372372
device.inputArea.oninput = function () {
373373
localStorage.boardState = this.value;
374-
if (this.value.length > 3) {
374+
if (this.value.length > 3 && this.value.length <= 8 && this.value.indexOf('.') === -1) {
375375
device.check(this.value);
376376
} else {
377377
device.icon.setAttribute('class', 'check icon-power');

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webduino-blockly",
3-
"version": "0.0.7",
3+
"version": "0.0.10",
44
"main": "index.js",
55
"description": "The Visual Programming Editor for Webduino",
66
"repository": "https://github.com/webduinoio/webduino-blockly.git",

Diff for: webduino-blockly.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
var konamiCode = "";
1818

19-
var speakSynth = window.speechSynthesis;
19+
var speakSynth = scope.speechSynthesis;
2020

2121
function boardReady(options, autoReconnect, callback) {
2222
var callback = (typeof autoReconnect === 'function' ? autoReconnect : callback),
@@ -115,7 +115,7 @@
115115
alpha = event.webkitCompassHeading;
116116
} else {
117117
alpha = event.alpha;
118-
if (!window.chrome) {
118+
if (!scope.chrome) {
119119
alpha = alpha - 270;
120120
}
121121
}
@@ -124,12 +124,12 @@
124124
listener.apply(this, [alpha, beta, gamma]);
125125
};
126126

127-
window.addEventListener('deviceorientation', orientationEventListener);
127+
scope.addEventListener('deviceorientation', orientationEventListener);
128128
}
129129
}
130130

131131
function removeDeviceOrientationListener() {
132-
window.removeEventListener('deviceorientation', orientationEventListener);
132+
scope.removeEventListener('deviceorientation', orientationEventListener);
133133
}
134134

135135
function setDeviceMotionListener(listener) {
@@ -144,7 +144,7 @@
144144
listener.apply(this, [x, y, z]);
145145
};
146146

147-
window.addEventListener('devicemotion', motionEventListener);
147+
scope.addEventListener('devicemotion', motionEventListener);
148148
}
149149
}
150150

@@ -180,7 +180,7 @@
180180

181181

182182
function removeDeviceMotionListener() {
183-
window.removeEventListener('devicemotion', motionEventListener);
183+
scope.removeEventListener('devicemotion', motionEventListener);
184184
}
185185

186186
function getLed(board, pin) {

0 commit comments

Comments
 (0)