-
-
Notifications
You must be signed in to change notification settings - Fork 266
[blockly] change event attributes, add return block #3376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[blockly] change event attributes, add return block #3376
Conversation
Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
#3444 Bundle Size — 11.38MiB (~+0.01%).4724d7c(current) vs f3c50b4 main#3443(baseline) Warning Bundle contains 2 duplicate packages – View duplicate packages Bundle metrics
|
Current #3444 |
Baseline #3443 |
|
---|---|---|
2.01MiB |
2.01MiB |
|
577.53KiB |
577.53KiB |
|
18.49% |
18.49% |
|
254 |
254 |
|
277 |
277 |
|
3035 |
3035 |
|
163 |
163 |
|
1.85% |
1.85% |
|
99 |
99 |
|
2 |
2 |
Bundle size by type
1 change
1 regression
Current #3444 |
Baseline #3443 |
|
---|---|---|
9.58MiB (+0.01% ) |
9.58MiB |
|
875.3KiB |
875.3KiB |
|
526.1KiB |
526.1KiB |
|
295.6KiB |
295.6KiB |
|
140.74KiB |
140.74KiB |
|
1.39KiB |
1.39KiB |
|
871B |
871B |
Bundle analysis report Branch stefan-hoehn:blockly_migrate_eve... Project dashboard
Generated by RelativeCI Documentation Report issue
When you add the docs, make sure to make it clear that return can only be used when the wrapper is enabled in the JS Scripting configs (MainUI -> Settings -> JS Scripting. |
Our idea was to make blockly automatically set the directive to enable the wrapper when return is used. |
you can actually see this in line 397 that creates "use wrapper" in the code. |
Is that something that can be done from a JS script? For example a rule template? I think I've found ways for my templates to work around that but knowing it's possible might prove helpful in the future. |
I haven't written docs for that yet, but the |
So I can enable the wrapper but not disable the wrapper? I'm not trying to argue about anything, just understand in case it's helpful to me in the rule templates and so I understand how it works in Blockly so I can help on the forum better. And don't you have actions and conditions backwards in your description. I thought the decision was to always enable it for Conditions and optionally enable it for Actions based on the add-on property. I could be remembering backwards, but that was what I thought. The reasoning was having the return statement in Conditions was worth keeping it always enabled, and doing so had minimal impact. |
Not sure if it helps. As soon as Blockly adds one of these blocks, it adds "'use wrapper'" to the top of the script that it generates. |
You can also disable it, there are three ways of using the wrapper:
The first two are equivalent.
I think you have to switch actions and conditions there. For actions, it is always enabled, since it has minimal to no impact, for conditions, there is the global add-on setting and the use wrapper directive to control the behaviour. |
Excellent! Thanks! |
Depends on: openhab/openhab-addons#19443
Lately there was a change on the attributes of the event object. This PR adapts the event block to this new naming and prevents warning messages in the logs.
Additionally a new return block was added to the "Run & Process" category with return parameter.
which can implemented by using an inline blockly script that evaluates to true or false.