mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-22 22:12:28 -05:00
Don't check for methods on window.native
It turns out that `window.native.someMethod` always evaluates as `undefined` -- even if calling that method would succeed. This change removes checks for such methods so that the WeDo2 blocks can work. Note that the hat blocks are still unimplemented, and some assumptions are made about the form that arguments and `util` will take.
This commit is contained in:
parent
e1109e8ca6
commit
e8089cd2a5
1 changed files with 3 additions and 3 deletions
|
@ -110,7 +110,7 @@ WeDo2Blocks.prototype._motorOnFor = function(direction, durationSeconds, util) {
|
|||
clearTimeout(this._motorTimeout);
|
||||
this._motorTimeout = null;
|
||||
}
|
||||
if (window.native && window.native.motorRun) {
|
||||
if (window.native) {
|
||||
window.native.motorRun(direction, this._motorSpeed);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ WeDo2Blocks.prototype._motorOnFor = function(direction, durationSeconds, util) {
|
|||
if (instance._motorTimeout == myTimeout) {
|
||||
instance._motorTimeout = null;
|
||||
}
|
||||
if (window.native && window.native.motorStop) {
|
||||
if (window.native) {
|
||||
window.native.motorStop();
|
||||
}
|
||||
util.done();
|
||||
|
@ -164,7 +164,7 @@ WeDo2Blocks.prototype._getColor = function(colorName) {
|
|||
};
|
||||
|
||||
WeDo2Blocks.prototype.setColor = function(argValues) {
|
||||
if (window.native && window.native.setLedColor) {
|
||||
if (window.native) {
|
||||
var rgbColor = this._getColor(argValues[0]);
|
||||
window.native.setLedColor(
|
||||
255 * rgbColor[0], 255 * rgbColor[1], 255 * rgbColor[2]);
|
||||
|
|
Loading…
Reference in a new issue