Answer the question
In order to leave comments, you need to log in
How to access your own property in a module method if someone else's context is attached?
There is a module like:
/* AB.js */
export default {
a: 'AAA',
b: function() {
this.a = '3 A';
}
}
b()
is called with another context attached:import AB from './AB'
setTimeout( AB.b.bind(null), 0);
b()
How can I make my own property available
in a method a
?
Answer the question
In order to leave comments, you need to log in
const self = {
a: 'AAA',
b: function() {
self.a = '3 A';
}
}
export default self;
Лучше вообще просто стрелочную функцию использовать в AB.js.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question