Skip to content

Commit

Permalink
[blockly] Cosmetic changes on cancel and reschedule timer blocks (#2163)
Browse files Browse the repository at this point in the history
Make the blocks say "Cancel [private|shared] timer XXX" and "after xx
reschedule [private|shared] timer XXXX"
Also put the reschedule block right after cancel.

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
  • Loading branch information
jimtng authored Nov 8, 2023
1 parent f4bbba0 commit d8c69fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export default function defineOHBlocks_Timers (f7, isGraalJs) {
}

/*
* Allows cancelation of a named timer
* Cancels a named timer
*
* Block type definition
*/
Expand All @@ -348,6 +348,7 @@ export default function defineOHBlocks_Timers (f7, isGraalJs) {
if (isGraalJs) {
tn.appendField(new Blockly.FieldDropdown([['private', 'private'], ['shared', 'shared']]), 'cache')
}
tn.appendField('timer')

this.setPreviousStatement(true, null)
this.setNextStatement(true, null)
Expand All @@ -358,7 +359,7 @@ export default function defineOHBlocks_Timers (f7, isGraalJs) {
}

/*
* Allows cancelation of a named timer
* Cancels a named timer
*
* Code generation
*/
Expand Down Expand Up @@ -395,6 +396,7 @@ export default function defineOHBlocks_Timers (f7, isGraalJs) {
if (isGraalJs) {
tn.appendField(new Blockly.FieldDropdown([['private', 'private'], ['shared', 'shared']]), 'cache')
}
tn.appendField('timer')

this.setInputsInline(true)
this.setPreviousStatement(true, null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,38 +526,38 @@
</shadow>
</value>
</block>
<block type="oh_timer_isActive">
<block type="oh_timer_reschedule">
<value name="timerName">
<shadow type="text">
<field name="TEXT">MyTimer</field>
</shadow>
</value>
<value name="delay">
<shadow type="math_number">
<field name="NUM">10</field>
</shadow>
</value>
</block>
<block type="oh_timer_isRunning">
<block type="oh_timer_isActive">
<value name="timerName">
<shadow type="text">
<field name="TEXT">MyTimer</field>
</shadow>
</value>
</block>
<block type="oh_timer_hasTerminated">
<block type="oh_timer_isRunning">
<value name="timerName">
<shadow type="text">
<field name="TEXT">MyTimer</field>
</shadow>
</value>
</block>
<block type="oh_timer_reschedule">
<block type="oh_timer_hasTerminated">
<value name="timerName">
<shadow type="text">
<field name="TEXT">MyTimer</field>
</shadow>
</value>
<value name="delay">
<shadow type="math_number">
<field name="NUM">10</field>
</shadow>
</value>
</block>
</category>

Expand Down

0 comments on commit d8c69fb

Please sign in to comment.