Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
101 views

Let's say we have two functions which first do some parameter checking. They return early if the checks are not met. Then they do stuff. Quite simple: function funcA (inputParam) { if(!inputParam....
cis's user avatar
  • 1,403
2 votes
2 answers
356 views

without Typescript experimentalDecorators: "true" using proposal-decorators by TC39 how can I do something like: class LambdaFunctionExample { lambdaResponse = [1, 2 , 3] @...
rb_engineer's user avatar
  • 1,046
-1 votes
2 answers
118 views

Is it possible to retrieve the implementation details of a Promise instance? Let's assume the following created promise ... let myPromise = new Promise(function (success, error) { /* implementation *...
user2276094's user avatar
-2 votes
1 answer
96 views

In this widget there is a function isPermitted(). How would I intercept it and overwrite it. I use the following to intercept other functions isPermittedDomain etc, but unable to overwrite the ...
MisterButter's user avatar
0 votes
1 answer
263 views

Question What is the current (~2024) solution to extend/wrap/intercept/decorate a typescript class with additional behaviour to separate concerns? There are various questions regarding wrapper classes,...
Samuel's user avatar
  • 6,518
2 votes
5 answers
292 views

Given the following code... function logger = ?? function doSomething() { logger("doSomething") console.log("Middle of doing something") } Is it possible to define logger ...
TG Person's user avatar
  • 473
0 votes
0 answers
30 views

What I am trying to do is intercept a function call, and prepend a header. The header is getting applied, the function itself is getting called, but the results don't have actually body. code: 'use ...
Christian Bongiorno's user avatar
0 votes
2 answers
1k views

I would like to add a wrapper function to one of my functions to show extra information. Below is my wrapper function: var wrap = function(functionToWarp, before) { var wrappedFunction = function() {...
Kit Law's user avatar
  • 392
0 votes
1 answer
435 views

Trying to capture response of a async request in dojo/aspect before() event before handing it off to the original method as below: aspect.before(ecm.model.SearchTemplate.prototype, "...
Le_Master's user avatar
  • 157
0 votes
1 answer
331 views

I am using dojo aspect.before to perform some actions prior to calling my original method. However, I am trying to cancel the original method if some criteria is not met within the aspect.before ...
Le_Master's user avatar
  • 157
0 votes
0 answers
58 views

I have a shared object named myModule contains many common-used functions: myModule alert: {showAlert: ƒ} upload: ƒ (e) uuid: {createUuid: ƒ} __proto__: Object Function maybe child or great-...
LittleQ's user avatar
  • 1,925
0 votes
0 answers
158 views

In my nodejs application, I have one particular method that I want to call after execution of every method. And I don't want any code modification in methods that is being called. I have implemented ...
Sourabh Mishra's user avatar
1 vote
1 answer
48 views

Consider I have class function home {}{ this.door=function(){}, this.tiles=function(){} } I have to add some message after it's methods are called using this library called meld js (https://...
jsduniya's user avatar
  • 2,472
2 votes
4 answers
573 views

My Question is about interface. I create an interface and define four methods: first method is a private method; second is a default method; third is a static method; and fourth is an abstract method. ...
Ng Sharma's user avatar
  • 2,212
1 vote
2 answers
311 views

When overriding a method in Kotlin, the base class defining the method and the method itself must be declared open. After overriding the method the derived class is final by default, while the ...
Harmlezz's user avatar
  • 8,088
-1 votes
1 answer
244 views

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 ...
Bernard Mizzi's user avatar
1 vote
1 answer
2k views

I'm having troubling understanding the point of the variable tmp in the following code: $.extend($.Widget.prototype, { yield: null, returnValues: { }, before: function(method, f) { ...
Jinghui Niu's user avatar
  • 1,158
2 votes
2 answers
2k views

I want to change all links assigned to window.location. So I assume location has getter & setter . That's why i cloned it & then i override the real window.location : var clonedLocation=...
Abdennour TOUMI's user avatar
1 vote
11 answers
3k views

I'm trying to get the example code below to work. Edit (Trying to be more clear what the aim is): I wan't to make all the functions and variables of the obj available in the functions setup and draw ...
fabianmoronzirfas's user avatar
0 votes
1 answer
44 views

function test() { alert(1); return "hello"; } Function.prototype.before = function (func) { var __bself = this; return function () { if (func.apply(this, arguments) == false) ...
Guanzhong Wang's user avatar
4 votes
3 answers
153 views

I have a very interesting predicament. I am working on a Perl script interface to the CVS repository and have created Perl Objects to represent Modules,Paths, and Files. Since Modules, Paths, and ...
tjwrona's user avatar
  • 9,117
3 votes
2 answers
635 views

I would like to measure the computing time of methods. A nice way is (How do you performance test JavaScript code?) with console.time('Function #1'); and console.timeEnd('Function #1'); My idea ...
Dominik Feininger's user avatar
1 vote
4 answers
902 views

Maybe some of you know about AOP, in some languages using AOP can lead you to be able to inject code after, before, or while a method is executing,etc. What I want is to apply the same in Javascript, ...
Bryan Arbelo - MaG3Stican's user avatar
0 votes
1 answer
182 views

It is possible to use an after modifier in a Role for a required attribute that is populated in the consuming class via a builder method? package A::Role; use Moose::Role; use IO::File; use Carp; ...
snoofkin's user avatar
  • 8,915
2 votes
1 answer
1k views

I want to do an AOP-like 'before' functionality for JavaScript functions. So I looked for existing solution and found the aop-plugin for jQuery. Unfortunately the plugin simply wraps the given ...
Stefan Ramson's user avatar
3 votes
2 answers
310 views

It's cool that it's possible to add them in sub classes or mix them in in roles. My problem is that it seems method modifiers from the base class get deactivated when subclasses redefine the method ...
memowe's user avatar
  • 2,668
2 votes
2 answers
212 views

I have a Moose BaseDBModel which has different subclasses mapping to my tables in the database. All the methods in the subclasses are like "get_xxx" or "update_xxx" which refers to the different DB ...
Dong YuKang's user avatar
1 vote
2 answers
2k views

Update The code I posted in my original question was illustrative of the way method modifier do or don't work. It was not necessarily illustrative of the problem description I gave. This code should ...
Lumi's user avatar
  • 15.5k
12 votes
1 answer
1k views

I have a Moose class that is intended to be subclassed, and every subclass has to implement an "execute" method. However, I would like to put apply a method modifier to the execute method in my class, ...
Ryan C. Thompson's user avatar
2 votes
3 answers
160 views

This is a follow up to a previous question. if I have multiple plugins/traits with around modifiers, is it possible to ensure a certain execution order (seeing as how I can't be sure which will ...
xenoterracide's user avatar
1 vote
2 answers
229 views

Is it possible to pass variables between multiple calls to the around MethodModier? example (that doesn't work but hopefully conveys what I want to do) sub mysub { ... }; around 'mysub' => sub { ...
xenoterracide's user avatar
3 votes
2 answers
855 views

I have a Role and several classes that mix-in the role. The Role class loads all of the implementing classes so that anything that imports Blah can use them without typing a lot of 'use' lines. ...
rjh's user avatar
  • 50.5k