README
<x-aspect>
A X-Tag element for AOP with before, around, on, afterReturning, afterThrowing, after advice, and pointcuts.
Maintained by Gianni Furger.
Wrapping meld by CujoJS team.
Use Cases
- Logging
- Profiling
- Security
- Transactions
Demo
Install
Install with Bower:
$ bower install --save x-tag-aspect
Usage
Import Web Components' polyfill:
<script src="dist/x-tags-components.js"></script>
Import
meld
:<script src="app/bower_components/meld/meld.js"></script>
Import Custom Element:
<script src="dist/aspect.js"></script>
Start using it!
<x-aspect origin="" source="console" function="log" advice="" condition="" trigger=""/>
Examples
HTML
<!-- Intercept console.log -->
<x-aspect origin="" source="console" function="log" advice="" condition="" trigger=""/>
JavaScript
You can listen to a aspect-changed
event for details about the aspect that was matched.
document.addEventListener('aspect-changed', function (aspect) {
console.log(aspect);
});
Setup
In order to run it locally you'll need a basic server setup.
Install Node.js
Install Grunt:
$ npm install --global grunt-cli
Install Bower
Install local dependencies:
$ npm install && bower install
Run a local server and open
http://localhost:3001
.$ grunt connect
Options
Attribute | Options | Default | Description |
---|---|---|---|
origin |
object | `` | - |
source |
*object | function* | `` |
function |
function | `` | - |
advice |
string | `` | - |
condition |
boolean | `` | - |
trigger |
event | `` | - |
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
History
For detailed changelog, check Releases.