added "suppress_signal_until"
@@ -142,6 +142,39 @@ call_on_x_position(300, !{
// },
+ suppress_signal_until: #[desc("Suppresses the signal until the desired group is called"), example(u"
+ func = !{
+ suppress_signal_until(5g)
+ @log::runtime::flash()
+ }
+
+ func! // does nothing
+ 5g!
+ wait(0.4)
+ func! // flashes
+ ")] (
+ #[desc("Group/trigger function to call to stop suppression (default: current context)")]
+ group: @group | @trigger_function = null,
+ ) -> @NULL {
+ // 0 = suppressed
+ // 1 = not suppressed
+ checker = @counter::new(bits = 1, reset = false)
+
+ -> (){
+ context_func = switch group {
+ @NULL: $.trigger_fn_context(),
+ else: group,
+ }
+ $.extend_trigger_func(context_func, (){
+ if checker == 0 { checker++ }
+ })
+ }()
+
+ if checker == 1 {
+ -> return
+ }
+ },
+
for_loop: #[desc("Implementation of a spawn loop with a counter"), example(u"
for_loop(0..10, (i) {
if i < 5 {
