0

If i have a object "tour" with the methods "back" and "next" and i have another object that i create:

let button: {
   text: "next Step",
   action: tour.next
}

Is there then any way, how i can store the method to execute on "tour." in a variable, so i have something like this:

String methodToExecute = "back"
let button: {
   text: "one Step back",
   action: tour.$(methodToExecute)
}

Does something like $() or anything exist to do this?

Why do i need something like this? I want to make a user guide with shepherd in javascript, but the user can fully program the tour in java, so i want to hand over a JSON with the buttons to the javascript part, where javascript decides which method to use for the action at the button. So, i can just make a new Button Object in Java with a "String str = "next"", or "String str = "back"" and pass this String to Javascript to call the specific Method on it.

Ji Lin
  • 61
  • 4

0 Answers0