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

JavaScript syntax extended classes #53

Closed
Markus-Harr opened this issue Mar 2, 2018 · 2 comments
Closed

JavaScript syntax extended classes #53

Markus-Harr opened this issue Mar 2, 2018 · 2 comments

Comments

@Markus-Harr
Copy link

Hi,
thanks you, this library is great.
Unfortunately I've problems with logging of extended classes.

Depending where I use @wove() only methods off one class are logged (either foo or bar), but I don't get both logged together if constructor is executed. If both classes use wove decorator or only ClassA uses decorator => foo is logged. If only ClassB uses decorator => bar is logged.

file classB.js

import {Wove} from 'aspect.js';

@Wove()
export default class ClassB extends ClassA {

    constructor() {
        this.foo();
        this.bar();
    }

    bar() {
        ...
    }
    ...
}

file classA.js

import {Wove} from 'aspect.js';

@Wove()
export default ClassA {
    foo() {
        ...
    }
    ...
}

file logger.js

import {
  beforeMethod,
} from 'aspect.js';

export default class LoggerAspect {
  @beforeMethod({
      methodNamePattern: /.*/,
      classNamePattern: /.*/
  })
  beforeLogger(meta, ...args) {
      ...
  }
...
}

What is the correct syntax for this case?

@mgechev
Copy link
Owner

mgechev commented Mar 2, 2018

Really good catch! I will push a fix in a bit.

@mgechev mgechev closed this as completed in be529e3 Mar 2, 2018
@mgechev
Copy link
Owner

mgechev commented Mar 2, 2018

This was the fix be529e3#diff-1ba746b3fa1602a2aa41de09ac00f034R4.

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

No branches or pull requests

2 participants