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

nodejs/node#55116 #15

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

nodejs/node#55116 #15

wants to merge 3 commits into from

Conversation

simon-id
Copy link
Member

@simon-id simon-id commented Oct 10, 2024

Add polyfill for a bugfix in node core: nodejs/node#55116

Comment on lines +29 to +34
ch.unsubscribe = function () {
// TODO: update me
this._subscribers = ArrayPrototypeSlice(this._subscribers);

return subscribe.apply(this, arguments);
};

Choose a reason for hiding this comment

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

Code Quality Violation

Unexpected unnamed function. (...read more)

It is easier to debug your application code when you avoid anonymous functions so that the stack trace can show you meaningful error messages. This rule enforces all your function to be consistently declared with a name.

View in Datadog  Leave us feedback  Documentation

Comment on lines +16 to +45
dc.channel = function () {
const ch = dc_channel.apply(this, arguments);

if (channels.has(ch)) return ch;

const { subscribe, unsubscribe, publish } = ch;

ch.subscribe = function () {
this._subscribers = ArrayPrototypeSlice(this._subscribers);

return subscribe.apply(this, arguments);
};

ch.unsubscribe = function () {
// TODO: update me
this._subscribers = ArrayPrototypeSlice(this._subscribers);

return subscribe.apply(this, arguments);
};

ch.publish = function () {
const self = Object.assign({}, this);

return publish.apply(self, arguments)
};

channels.add(ch);

return ch;
};

Choose a reason for hiding this comment

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

Code Quality Violation

Unexpected unnamed function. (...read more)

It is easier to debug your application code when you avoid anonymous functions so that the stack trace can show you meaningful error messages. This rule enforces all your function to be consistently declared with a name.

View in Datadog  Leave us feedback  Documentation

Comment on lines +9 to +48
module.exports = function (unpatched) {
const channels = new WeakSet();

const dc_channel = unpatched.channel;

const dc = { ...unpatched };

dc.channel = function () {
const ch = dc_channel.apply(this, arguments);

if (channels.has(ch)) return ch;

const { subscribe, unsubscribe, publish } = ch;

ch.subscribe = function () {
this._subscribers = ArrayPrototypeSlice(this._subscribers);

return subscribe.apply(this, arguments);
};

ch.unsubscribe = function () {
// TODO: update me
this._subscribers = ArrayPrototypeSlice(this._subscribers);

return subscribe.apply(this, arguments);
};

ch.publish = function () {
const self = Object.assign({}, this);

return publish.apply(self, arguments)
};

channels.add(ch);

return ch;
};

return dc;
};

Choose a reason for hiding this comment

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

Code Quality Violation

Unexpected unnamed function. (...read more)

It is easier to debug your application code when you avoid anonymous functions so that the stack trace can show you meaningful error messages. This rule enforces all your function to be consistently declared with a name.

View in Datadog  Leave us feedback  Documentation

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.

1 participant