Skip to content
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

Feature: Support other script engine besides Otto #652

Open
1 task done
chopmann opened this issue Dec 23, 2021 · 2 comments
Open
1 task done

Feature: Support other script engine besides Otto #652

chopmann opened this issue Dec 23, 2021 · 2 comments

Comments

@chopmann
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary

What is the use-case?

The JS-Engine "Otto" while being providing a solid foundation, is lacking on some of the more modern ways/features of writing JS.
@sagar-patel-sls mentioned goja (https://github.com/dop251/goja)
something like yaegi (https://github.com/traefik/yaegi) could also be useful, and provide a standard set of utils.

Implementation description

Forum User: https://forum.chirpstack.io/u/marsman

To make the replacement of the JavaScript engine not breaking anything it seems to be an option to extend the DropDown list to choose the JavaScript engine (current “Custom JavaScript codec functions” should be renamed to indicate that his refers to the outdated Otto JS engine).
On updates this can would still default to the Otto JS Engine, so the old scripts still work and if you add a new “Device profile” the Codec would use the new JavaScript engine (=default to goja)

Can you implement this by yourself and make a pull request?

Some parts of it. Depends which engine(s) we want to add/support.

@brocaar
Copy link
Owner

brocaar commented Dec 23, 2021

I'm aware of its limitations. While you will not find anything on GitHub yet, I am working on a refactor and cleanup of the code-base. One of the items that this refactor will address is replacing the Otto JS engine. I'm planning to write something on the forum about these changes soon.

@hubpav
Copy link

hubpav commented Jan 31, 2022

@brocaar Are you planning to abandon Otto whatsoever in the future? If that is the case, this feature request I have submitted would have a short lifespan: #664

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants