-1

I need to use an AOP library, I found aspect.js from https://github.com/mgechev/aspect.js but I require to use it in the browser while an application is running. Does someone have any idea of how this can be used in the browser? There are no clear explanations of how this can be achieved.

Peter Seliger
  • 11,747
  • 3
  • 28
  • 37
Bernard Mizzi
  • 49
  • 1
  • 1
  • 8
  • Regarding the `AOP` tag, wrapping and reassigning already declared functionality (be it functions or methods) misses any aspect of _AOP_. Any language which wants to qualify for the latter has to provide abstraction levels for at least `Joinpoint`, `Advice` and `Aspect`. The use case described by the OP should be referred to as method modification, and JavaScript of cause is well suited for this scenario and could easily provide a complete `target`/`context` aware toolset of method modifiers like `around`, `before`, `after`, `afterThrowing` and `afterFinally` via `Function.prototype`. – Peter Seliger Sep 14 '22 at 17:09

1 Answers1

0

As you would do with other lib : using <script> tag, aspect is then attached to window :

<script src="path/to/aspect-js.js"></script>
<script>
  aspect.before(...);
  ...
</script> 
EricLavault
  • 12,130
  • 3
  • 23
  • 45
  • There are different versions of aspect.js, the one you provided is different from the one I require: https://github.com/mgechev/aspect.js. I first included it as a hyperlink but now I provided the whole visible link in the question. – Bernard Mizzi Mar 18 '18 at 09:56
  • Yes of course I provided a path example but the method would be the same using the correct sources. – EricLavault Mar 18 '18 at 10:02
  • No, this method does not work for the library that I want, thanks anyways. – Bernard Mizzi Mar 19 '18 at 08:44