Everything works fine when I wrote the js logic in a closure as a single js file, as:
(function(win){
//main logic here
win.expose1 = ....
win.expos
I have faced this issue when I created a new ES2015 class where the property name was equal to the method name.
e.g.:
class Test{
constructor () {
this.test = 'test'
}
test (test) {
this.test = test
}
}
let t = new Test()
t.test('new Test')
Please note this implementation was in NodeJS 6.10.
As a workaround (if you do not want to use the boring 'setTest' method name), you could use a prefix for your 'private' properties (like _test
).
Open your Developer Tools in jsfiddle.