-
Notifications
You must be signed in to change notification settings - Fork 2
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
Inject component scope into class? #484
Comments
If done, extending the Example: module.exports = class Endpoint extends Item {
constructor(obj, scope) {
super(obj, [
Command,
State,
Item
], scope); (Pseudo-) Implementation: module.exports = class Item {
constructor(obj, classess, scope) {
Object.assign(this, obj);
classsess.forEach((cls) => {
// InjectProperty();
// DefineShaodwProperty();
Object.defineProperty(cls.prototype, "scope", scope);
// Object.defineProperty(cls, "scope", scope);
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usally a compponent definition looks like this:
Instead of passing for every item class instance (in this case
SSDP
) the component scope (backend/components/endpoints/class.endpoint.js
Line 36 in dbf499e
super("ssdp", SSDP, module, this);
)In
class.component.js
then:This would be smart and "dumb" both ways.
Smart because no explitiz definition/passing is needed, dumb for the exact same reason, which could make it hard for documentation/figure out whats going on. Maybe anti pattern.
Same cathegory as "ShadowProperties", see #453
The text was updated successfully, but these errors were encountered: