FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

lib: refactor NativeModule by joyeecheung · Pull Request #30856 · nodejs/node · GitHub

/ node Public

lib: refactor NativeModule - #30856

Closed
joyeecheung wants to merge 1 commit into
nodejs:masterfrom
joyeecheung:class-module
Closed

lib: refactor NativeModule#30856
joyeecheung wants to merge 1 commit into
nodejs:masterfrom
joyeecheung:class-module

Conversation

joyeecheung commented Dec 8, 2019
edited
Loading

Copy link
Copy Markdown
Member

Refactor the internal NativeModule class to a JS class and add
more documentation about its properties.

Tip: https://github.com/nodejs/node/pull/30856/files?w=1 is easier to review

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Refactor the internal NativeModule class to a JS class and add
more documentation about its properties.

Copy link
Copy Markdown
Collaborator

this.canBeRequiredByUsers = !id.startsWith('internal/');

// The CJS exports object of the module.
this.exports = {};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Wouldn't a public (or maybe private) field declaration be preferable?

class NativeModule {
  exports = {};
  #loaded = false;
  #loading = false;
  module = undefined;
  exportKeys = undefined;
}

I personally find it more readable than a declaration in the constructor, but that might just be me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

i don't mind if private fields are used but i think we should keep field initialization in one spot (in this case, the constructor, since it assigns from arguments).

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Trott added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Dec 13, 2019

Trott commented Dec 14, 2019

Copy link
Copy Markdown
Member

Landed in e4e5a83

Trott closed this Dec 14, 2019
Trott pushed a commit that referenced this pull request Dec 14, 2019
Refactor the internal NativeModule class to a JS class and add
more documentation about its properties.

PR-URL: #30856
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Rich Trott <rtrott@gmail.com>
MylesBorins pushed a commit that referenced this pull request Dec 17, 2019
Refactor the internal NativeModule class to a JS class and add
more documentation about its properties.

PR-URL: #30856
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Rich Trott <rtrott@gmail.com>
MylesBorins mentioned this pull request Dec 17, 2019
targos pushed a commit that referenced this pull request Jan 14, 2020
Refactor the internal NativeModule class to a JS class and add
more documentation about its properties.

PR-URL: #30856
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Rich Trott <rtrott@gmail.com>
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
Refactor the internal NativeModule class to a JS class and add
more documentation about its properties.

PR-URL: #30856
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Rich Trott <rtrott@gmail.com>
MylesBorins mentioned this pull request Feb 8, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL