Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add demo with aspect in external file
- Loading branch information
Showing
4 changed files
with
39 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { aroundMethod, Metadata } from '../lib/index'; | ||
|
||
export default class ExternalAspect { | ||
@aroundMethod({ classNamePattern: /.*/, methodNamePattern: /.*/ }) | ||
around(metadata: Metadata) { | ||
console.assert(metadata.className === 'Demo'); | ||
console.assert(metadata.method.name === 'get'); | ||
|
||
metadata.method.proceed = false; | ||
metadata.method.result = 'ExternalAspect'; | ||
|
||
console.log('aspect'); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import './aspect'; | ||
import { Wove } from '../lib/index'; | ||
|
||
@Wove() | ||
class Demo { | ||
get(foo: any, bar: any): string { | ||
return 'Demo'; | ||
} | ||
} | ||
|
||
const d = new Demo(); | ||
d.get(1, 2); |
This file contains 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
This file contains 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
1 comment
on commit 265462a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just submitted PR #66 to prove this.
The trailing comma on line 20 is breaking the CI build.