schickling/chromeless

Can't use evaluate with ES6 shorthand method definition on objects

DATADEER opened this issue · 0 comments

I can't use evaluate with ES6 shorthand method definition on objects .
Everytime i pass a method into evaluate (that was previously defined via ES6 shorthand method definition) , it will throw an error "Unexpected token {"

this throws an error "Unexpected token {"

theObject: {

selector: "#someid",
text: "this is some text",

hasElementThisText(selector, text){
        return document.querySelector(selector).innerText.includes(text)
},

}
//  this throws an error Unexpected token {
chromeless.evaluate(hasElementThisText, [theObject.selector, theObject.text]) 

this works flawlessy

theObject: {

selector: "#someid",
text: "this is some text",

hasElementThisText: function (selector, text){
        return document.querySelector(selector).innerText.includes(text)
},

}
// works correctly
chromeless.evaluate(hasElementThisText, [theObject.selector, theObject.text])