Message from JavaScript discussions

July 2017

— Which region is that,,?

— 

Well I'm not headhunting or advertising :) please keep in mind :) The company that I work for - EPAM Systems has quite a few offices around the globe, most of them in Europe, couple in China, US. There's one in Mexico too

— Always wanted to go for few weeks to Mexico.

— Let me see if I can find that link with office locations.

— Https://www.epam.com/contact

— I'm personally in Switzerland right now, but before that lived and worked in China for 3 years :)

— TRGWII Hmm, I need some advice

— I am trying some Aspect Oriented Programming with Promises, but I am not sure how to automate the promise chain

Message permanent page

— An Aspect looks like this

Aspect.prototype.execute = function (state) {
return Promise.resolve(state)
.then(this.enter)
.catch(this.errorHandler)
.then(this.main)
.catch(this.errorHandler)
.then(this.exit)
.catch(this.errorHandler);
};

Message permanent page

— And then I try chaining like this

function Strategy(...aspects) {
this.aspects = aspects;
}
Strategy.prototype.execute = function (...arguments) {
var curAspect = this.aspects[0].execute(arguments);
for (var loc = 1; loc < this.aspects.length; loc++) {
curAspect = curAspect.then(this.aspects[loc].execute);
}
};

Message permanent page

— Since then is a cw/cs function it is good for AOP I think

— But looking at that for loop do you think that is a good way to chain?