kopia lustrzana https://github.com/backface/turtlestitch
speed up HTTP based hardware APIs
by not waiting for the result if the URL reporter is used inside a REPORT block within a custom COMMAND block definitionupd4.2
rodzic
6fee9698ed
commit
1dfb9dfa67
4
gui.js
4
gui.js
|
@ -75,7 +75,7 @@ isRetinaSupported, SliderMorph, Animation, BoxMorph, MediaRecorder*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.gui = '2018-June-21';
|
||||
modules.gui = '2018-July-03';
|
||||
|
||||
// Declarations
|
||||
|
||||
|
@ -3504,7 +3504,7 @@ IDE_Morph.prototype.aboutSnap = function () {
|
|||
module, btn1, btn2, btn3, btn4, licenseBtn, translatorsBtn,
|
||||
world = this.world();
|
||||
|
||||
aboutTxt = 'Snap! 4.2\nBuild Your Own Blocks\n\n'
|
||||
aboutTxt = 'Snap! 4.2.1 - dev -\nBuild Your Own Blocks\n\n'
|
||||
+ 'Copyright \u24B8 2018 Jens M\u00F6nig and '
|
||||
+ 'Brian Harvey\n'
|
||||
+ 'jens@moenig.org, bh@cs.berkeley.edu\n\n'
|
||||
|
|
|
@ -4179,7 +4179,6 @@ Translation Updates:
|
|||
------
|
||||
* Threads, Objects: made "When I am stopped" scripts atomic, so you can use loops
|
||||
|
||||
|
||||
=== v4.2 major release ===
|
||||
|
||||
v4.2 New Features:
|
||||
|
@ -4211,3 +4210,10 @@ Translation Updates:
|
|||
* German, thanks, Jadga!
|
||||
* Portuguese, thanks, Manuel!
|
||||
* Catalan, thanks, Joan!
|
||||
|
||||
=== in development ===
|
||||
|
||||
180703
|
||||
------
|
||||
* speed up HTTP based hardware APIs (by not waiting for the result if the URL reporter is used inside a REPORT block within a custom COMMAND block definition)
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Snap! Build Your Own Blocks 4.2</title>
|
||||
<title>Snap! Build Your Own Blocks 4.2.1 - dev -</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<script type="text/javascript" src="morphic.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="widgets.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="blocks.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="threads.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="threads.js?version=2018-07-03"></script>
|
||||
<script type="text/javascript" src="objects.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="gui.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="gui.js?version=2018-07-03"></script>
|
||||
<script type="text/javascript" src="paint.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="lists.js?version=2018-06-21"></script>
|
||||
<script type="text/javascript" src="byob.js?version=2018-06-21"></script>
|
||||
|
|
14
threads.js
14
threads.js
|
@ -62,7 +62,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy,
|
|||
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph,
|
||||
TableFrameMorph, ColorSlotMorph, isSnapObject*/
|
||||
|
||||
modules.threads = '2018-June-21';
|
||||
modules.threads = '2018-July-03';
|
||||
|
||||
var ThreadManager;
|
||||
var Process;
|
||||
|
@ -789,7 +789,7 @@ Process.prototype.doReport = function (block) {
|
|||
if (this.isClicked && (block.topBlock() === this.topBlock)) {
|
||||
this.isShowingResult = true;
|
||||
}
|
||||
if (this.context.expression.partOfCustomCommand) {
|
||||
if (block.partOfCustomCommand) {
|
||||
this.doStopCustomBlock();
|
||||
this.popContext();
|
||||
} else {
|
||||
|
@ -812,8 +812,9 @@ Process.prototype.doReport = function (block) {
|
|||
}
|
||||
// in any case evaluate (and ignore)
|
||||
// the input, because it could be
|
||||
// and HTTP Request for a hardware extension
|
||||
// an HTTP Request for a hardware extension
|
||||
this.pushContext(block.inputs()[0], outer);
|
||||
this.context.isCustomCommand = block.partOfCustomCommand;
|
||||
};
|
||||
|
||||
// Process: Non-Block evaluation
|
||||
|
@ -2301,6 +2302,11 @@ Process.prototype.reportURL = function (url) {
|
|||
this.httpRequest = new XMLHttpRequest();
|
||||
this.httpRequest.open("GET", url, true);
|
||||
this.httpRequest.send(null);
|
||||
if (this.context.isCustomCommand) {
|
||||
// special case when ignoring the result, e.g. when
|
||||
// communicating with a robot to control its motors
|
||||
return null;
|
||||
}
|
||||
} else if (this.httpRequest.readyState === 4) {
|
||||
response = this.httpRequest.responseText;
|
||||
this.httpRequest = null;
|
||||
|
@ -4004,6 +4010,7 @@ Process.prototype.reportAtomicSort = function (list, reporter) {
|
|||
activeNote audio oscillator for interpolated ops, don't persist
|
||||
activeSends forked processes waiting to be completed
|
||||
isCustomBlock marker for return ops
|
||||
isCustomCommand marker for interpolated blocking reporters (reportURL)
|
||||
emptySlots caches the number of empty slots for reification
|
||||
tag string or number to optionally identify the Context,
|
||||
as a "return" target (for the "stop block" primitive)
|
||||
|
@ -4034,6 +4041,7 @@ function Context(
|
|||
this.activeAudio = null;
|
||||
this.activeNote = null;
|
||||
this.isCustomBlock = false; // marks the end of a custom block's stack
|
||||
this.isCustomCommand = null; // used for ignoring URL reporters' results
|
||||
this.emptySlots = 0; // used for block reification
|
||||
this.tag = null; // lexical catch-tag for custom blocks
|
||||
this.isFlashing = false; // for single-stepping
|
||||
|
|
Ładowanie…
Reference in New Issue