forked from olov/ng-annotate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin-example.js
30 lines (23 loc) · 1.15 KB
/
plugin-example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var ctx;
module.exports = {
init: function(_ctx) {
console.error("plugin init called, got ctx with keys " + Object.keys(_ctx));
// ctx contains a bunch of helpers and data
// stash it away so you can use it inside match
ctx = _ctx;
// if you want to setup position triggers now, checkout nginject-comments.js
},
match: function(node) {
console.error("plugin match called, node with type " + node.type);
// if you think you have a match, return the found target node
// (may or may not be the passed in argument node)
// you may also return an array of target nodes
// ng-annotate will then execute replaceRemoveOrInsertArrayForTarget
// on every target, i.e. it may remove an array (if --remove) and it may
// add an array (if --add)
// please consider filing an issue if you need to workaround a defect or
// an obviously missing feature in ng-annotate. we'll try to fix it!
// you know about /* @ngInject */, don't you? (you may not need a plugin)
// please consider sending a pull request if your plugin is of general use
},
};