-
Notifications
You must be signed in to change notification settings - Fork 173
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
refactor, fix and add feat to js bridge #132
refactor, fix and add feat to js bridge #132
Conversation
Navigation API is experimental and not in firefox, safari of opera, need to polyfill
Keep internal attributes and methods private
Construct Uint8Array with "of" instead of push data into it. Use template string. Remove temp constants.
use Uint8Array.of to construct buffer instead of pushing datas through a loop
Reduce code nesting. Remove deduplicated code. Improve readability. Use template literals instead of string concatenation. Use Uint8Array.of instead of pushing manually data into. Simplify code.
Use addRefreshableEventListner instead of directly binding event listeners to automatically attanch listener if html code is injected client side by the user.
BREAKING CHANGE: Rename API mathods for better expressivity.
Use the same path as in github action to keep the same variables names.
This is really a big improvement to the project. Thank you @JOTSR 👍 |
Ok I will add it later. |
I don't think we should add The APIs |
@AlbertShown As example_feat.mp4 |
Summary
Encapse private methods and attributes inside a class to securise access with private fields. Support JSON handling. Fix logic and types errors. Simplify code...
Motivation
One of the challenges of this project is the JS bridge, which is difficult to maintain for contributors and hard to discover for new users. A possible improvement is to rewrite the bridge using typescript, which has several benefits. First, it improves discoverability, as typescript can help with code completion and documentation. Second, it improves interoperability by providing type hints and safeguards. Third, as typescript is used in source code it don't affect the final execution (only JS is embedded). Moreover, for internal use, typescript can prevent errors (many references and typos in the original JS bridge have been caught by typescript) and improve project structure by enforcing types and modules.
Main changes