mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
27 lines
647 B
JavaScript
27 lines
647 B
JavaScript
module.exports = {
|
|
record: function(component, name, args, thisObj) {
|
|
var hooksByComponent = this.hooksByComponent || (this.hooksByComponent = {});
|
|
|
|
var hooksArray = hooksByComponent[component] || (hooksByComponent[component] = []);
|
|
|
|
|
|
|
|
hooksArray.push({
|
|
name: name,
|
|
args: args,
|
|
thisObject: thisObj
|
|
});
|
|
},
|
|
|
|
reset: function() {
|
|
this.hooksByComponent = {};
|
|
},
|
|
|
|
getHookNames: function(component) {
|
|
var hooksArray = this.hooksByComponent[component];
|
|
|
|
return hooksArray.map(function(hook) {
|
|
return hook.name;
|
|
});
|
|
}
|
|
}; |