Photon Paw

An easy and convenient lib to add HTML-based UI to a console app

Лицензия

Лицензия

Категории

Категории

Сеть
Группа

Группа

net.timzh
Идентификатор

Идентификатор

photon-paw
Последняя версия

Последняя версия

0.10.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Photon Paw
An easy and convenient lib to add HTML-based UI to a console app
Ссылка на сайт

Ссылка на сайт

http://timzh.net/photon-paw/
Система контроля версий

Система контроля версий

http://github.com/tim-zh/photon-paw/tree/master

Скачать photon-paw

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/net.timzh/photon-paw/ -->
<dependency>
    <groupId>net.timzh</groupId>
    <artifactId>photon-paw</artifactId>
    <version>0.10.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.timzh/photon-paw/
implementation 'net.timzh:photon-paw:0.10.0'
// https://jarcasting.com/artifacts/net.timzh/photon-paw/
implementation ("net.timzh:photon-paw:0.10.0")
'net.timzh:photon-paw:jar:0.10.0'
<dependency org="net.timzh" name="photon-paw" rev="0.10.0">
  <artifact name="photon-paw" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.timzh', module='photon-paw', version='0.10.0')
)
libraryDependencies += "net.timzh" % "photon-paw" % "0.10.0"
[net.timzh/photon-paw "0.10.0"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
io.undertow : undertow-core jar 2.0.28.Final
commons-logging : commons-logging jar 1.2
net.sourceforge.htmlunit : htmlunit jar 2.36.0

test (3)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-api jar 5.5.2
org.junit.jupiter : junit-jupiter-engine jar 5.5.2
org.junit.jupiter : junit-jupiter-params jar 5.5.2

Модули Проекта

Данный проект не имеет модулей.

PhotonPaw

Maven Central

CircleCI

Backend Example:

new net.timzh.photonpaw.PhotonPaw()
    //optional, configure main port and websocket port
    .ports(19081, 19082)

    //set location of static resources if any, empty string to refer to jar resources
    .resourcesRoot("")

    //add additional routes if static resources are not enough
    .bindPath("/test", request -> UiHttpResponse.of("application/javascript", "alert('custom routing')"))

    //subscribe to events from ui by name
    .handleCommand("a", (msg, out) -> System.out.println("command received"))

    //subscribe to requests from ui that expect some response
    .handleQuery("b", msg -> "server response")

    //subscribe to events with dynamic names
    .defaultHandler((msg, out) -> System.out.println("unknown event " + msg))

    //execute some code after establishing a connection with ui
    .start(out ->

         //send an event to ui
         out.send("b", "server command")
    )

    .println("ui server started")
    .openBrowser("/index.html")
    .waitForTabToUnload()
    .stop();

Frontend Example:

<!DOCTYPE html>
<html>
<body>
<script src="photonpaw_client.js"></script>
<script>
PhotonPaw
    //subscribe to events from ui server by name
    .handleCommand("a", msg => alert("command received"))

    //subscribe to events with dynamic names
    .defaultHandler((event, msg) => alert("unknown event " + event + " " + msg))

    //execute some code after establishing the connection with ui server
    .start().then(() => {

        //send an event to ui server
        PhotonPaw.send("b", "ui command");

        //send a request to ui server and process the response
        PhotonPaw.ask("c", "ui query").then(response => alert("query response received"));
    });
</script>
</body>
</html>

Версии библиотеки

Версия
0.10.0
0.9.2
0.9.1
0.9.0