-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[web] Remove package:js in favor of dart:js_interop #164254
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
[web] Remove package:js in favor of dart:js_interop #164254
Conversation
| extension FlutterLoaderExtension on FlutterLoader { | ||
| external void didCreateEngineInitializer(FlutterEngineInitializer initializer); | ||
| bool get isAutoStart => !js_util.hasProperty(this, 'didCreateEngineInitializer'); | ||
| bool get isAutoStart => !(this as JSObject).has('didCreateEngineInitializer'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the type of FlutterLoader? is it a JSObject?
|
|
||
| bool domInstanceOfString(Object? element, String objectType) => | ||
| js_util.instanceOfString(element, objectType); | ||
| bool domInstanceOfString(JSAny element, String objectType) => element.instanceOfString(objectType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe as a follow-up, we should deprecate/remove this and just inline the call
| // found in the LICENSE file. | ||
|
|
||
| @JS() | ||
| library js_loader; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to drop the library name here!
|
I think I gotta put this one on pause for now. I am hitting a ton of problems with DOMEventListeners running in the wrong zone and issues with events seemingly never firing ("focus" events in particular aren't firing in tests) |
😢 CC @srujzs – we should figure out if this is something systemic |
|
I was able to work around some of the zone issues using the technique outlined here: dart-lang/sdk#54507 However, this didn't fix the issues with the |
Yup, I was just about to mention this. This is more or less does what
I'm happy to help debug here if you'd like to point me to the specific test. It's possible there's some unobvious semantic differences in registering the event listener. |
|
@srujzs I added this test (dom_focus_event_test.dart) when I was trying to debug the issue: https://github.com/flutter/flutter/pull/164254/files#diff-4cce257d905c908ac4719d3a062beac4d5f91ec21d616c60019e9612ebd10b74 |
|
It looks like Adding If it's |
|
@srujzs – @harryterkelsen is on leave for many weeks. If you're bored, would you be willing to take this over? |
|
Ah, sure, I'll take a stab at it. I'd like to get this in so that the work doesn't become stale. |
Removes package:js and uses dart:js_interop instead This is taken directly from flutter#164254 and will be iterated on.
Removes package:js and uses dart:js_interop instead This is taken directly from flutter#164254 and will be iterated on.
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Removes package:js and uses dart:js_interop instead This is taken directly from #164254 and will be iterated on. ---- Initial commit is the original PR % rebasing. Follow-up commits address test/analysis failures and commits after those clean up JS interop code: - Remove remaining uses of `@staticInterop`. - Code that uses JSBoolean, JSString, or JSNumber are mostly historical relics due to not supporting primitives in externals. Remove the redirecting functions and let the compiler handles the conversions. - Replace domInstanceOfString calls with isA and add @js annotations to all extension types where needed. - Remove unnecessary @js annotations. - Remove unneeded implements JSObject clauses. - Standardize naming of extension types in some cases. - Remove JSVoid in favor of void. - Enabled invalid_runtime_checks_with_js_interop_types lint. - Removed unnecessary JSUint8Array constructors. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. --------- Co-authored-by: Kevin Moore <[email protected]>
|
This was landed with other changes in #165324, so I'm going to go ahead and close this. |
Removes package:js and uses dart:js_interop instead This is taken directly from flutter#164254 and will be iterated on. ---- Initial commit is the original PR % rebasing. Follow-up commits address test/analysis failures and commits after those clean up JS interop code: - Remove remaining uses of `@staticInterop`. - Code that uses JSBoolean, JSString, or JSNumber are mostly historical relics due to not supporting primitives in externals. Remove the redirecting functions and let the compiler handles the conversions. - Replace domInstanceOfString calls with isA and add @js annotations to all extension types where needed. - Remove unnecessary @js annotations. - Remove unneeded implements JSObject clauses. - Standardize naming of extension types in some cases. - Remove JSVoid in favor of void. - Enabled invalid_runtime_checks_with_js_interop_types lint. - Removed unnecessary JSUint8Array constructors. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. --------- Co-authored-by: Kevin Moore <[email protected]>
Removes package:js and uses dart:js_interop instead This is taken directly from flutter#164254 and will be iterated on. ---- Initial commit is the original PR % rebasing. Follow-up commits address test/analysis failures and commits after those clean up JS interop code: - Remove remaining uses of `@staticInterop`. - Code that uses JSBoolean, JSString, or JSNumber are mostly historical relics due to not supporting primitives in externals. Remove the redirecting functions and let the compiler handles the conversions. - Replace domInstanceOfString calls with isA and add @js annotations to all extension types where needed. - Remove unnecessary @js annotations. - Remove unneeded implements JSObject clauses. - Standardize naming of extension types in some cases. - Remove JSVoid in favor of void. - Enabled invalid_runtime_checks_with_js_interop_types lint. - Removed unnecessary JSUint8Array constructors. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. --------- Co-authored-by: Kevin Moore <[email protected]>
Removes
package:jsand usesdart:js_interopinsteadPre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.