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

Add interop for Atomics #85

Merged
merged 3 commits into from
Oct 29, 2020
Merged

Add interop for Atomics #85

merged 3 commits into from
Oct 29, 2020

Conversation

nex3
Copy link
Collaborator

@nex3 nex3 commented Oct 28, 2020

No description provided.

Copy link
Owner

@pulyaevskiy pulyaevskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good, just have a few minor comments. PTAL.

// Copyright (c) 2020, Anatoly Pulyaevskiy. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

/// Bindings for the Atomics JavaScript obect. Since this object only has static
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: obect => object.


/// Bindings for the Atomics JavaScript obect. Since this object only has static
/// methods, it's exposed as a module so that it can be used in the standard
/// Dart style.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I prefer to preserve, if possible, is to keep bindings closer to the actual JS API. What do you think of adding a container Atomics abstract class and making the below methods static inside it? I think JS interop supports external static methods, but I'm not 100% sure.

/// methods, it's exposed as a module so that it can be used in the standard
/// Dart style.
@JS()
library node_interop.atomics;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it looks like Atomics is a global JS object, so we need to add an export of atomics in lib/node.dart which is where all the global stuff is exported.

@nex3
Copy link
Collaborator Author

nex3 commented Oct 28, 2020

Moved it into js.dart (since it's a globally-available JS name, not Node-specific) and updated the API to match the JS API.

Copy link
Owner

@pulyaevskiy pulyaevskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, build failure is unrelated to this change (and is rather weird, pub installs build_modules 2.11.0 when it can install 2.11.1, which is what happens locally and resolves the issue).

Merging. Thanks again!

@pulyaevskiy pulyaevskiy merged commit c54fa28 into pulyaevskiy:master Oct 29, 2020
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

Successfully merging this pull request may close these issues.

2 participants