fun waiting(id) client { receive { case MouseDown(elem) -> if (isElementNode(elem) && (parentNode(elem) == getNodeById(id))) dragging(id, elem) else waiting(id) case MouseUp -> waiting(id) case MouseOut(toElem) -> waiting(id) } } fun dragging(id, elem) client { receive { case MouseUp -> waiting(id) case MouseDown(elem) -> if (isElementNode(elem) && (parentNode(elem) == getNodeById(id))) dragging(id, elem) else waiting(id) case MouseOut(toElem) -> if (isElementNode(toElem) && (parentNode(toElem) == getNodeById(id))) { swapNodes(elem, toElem); dragging(id, elem) } else dragging(id, elem) } } fun format(text) {
  • {stringToXml(text)}
  • } fun draggableList(id, items) { var x = id; var dragger = spawnClient { waiting(id) }; } fun main() { page

    Great Bears

    {draggableList("bears",["Pooh", "Paddington", "Rupert", "Edward"])}

    Great Beers

    {draggableList("beers",["Budvar", "Delirium Tremens", "Deuchars"])}

    Great Boars

    {draggableList("boars",["Sus scrofa scrofa","Sus scrofa ussuricus", "Sus scrofa cristatus","Sus scrofa taiwanus"])} } main()