Skip to content
Snippets Groups Projects
Commit bb046666 authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

#195 - Add method to fetch current page over web api

parent 4640e9d1
Branches
Tags
No related merge requests found
......@@ -22,7 +22,8 @@ class WebSocketHandler {
"cart-action" -> new CartActionMethod,
"page-action" -> new PageActionMethod,
"navigate-action" -> new NavigateActionMethod,
"stop-action" -> new StopActionMethod
"stop-action" -> new StopActionMethod,
"current-page-request" -> new CurrentPageRequestMethod
)
@OnWebSocketConnect def connected(session: Session): Unit = {
......
package de.tobias.playpad.plugin.api.websocket.methods
import com.google.gson.JsonObject
import de.tobias.playpad.PlayPadPlugin
import de.tobias.playpad.plugin.api.websocket.MethodExecutable
import de.tobias.playpad.plugin.api.websocket.message.Message
import org.eclipse.jetty.websocket.api.Session
class CurrentPageRequestMethod extends MethodExecutable {
override def execute(session: Session, message: Message): JsonObject = {
val response = new JsonObject()
response.addProperty("page", PlayPadPlugin.getInstance().getMainViewController.getPage)
response
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment