summaryrefslogtreecommitdiffstats
path: root/plugins/samples
AgeCommit message (Expand)AuthorFilesLines
2016-04-21manages reference counting for eventsJosé Bollo1-1/+1
2016-04-19initial event handlerJosé Bollo1-4/+14
2016-04-19refactoring context handlingJosé Bollo1-36/+6
2016-04-19prepares event propagationJosé Bollo3-3/+0
2016-04-18changing the license to apache 2José Bollo3-30/+27
2016-04-08refactoring req interfaceJosé Bollo2-39/+4
2016-04-07minorJosé Bollo1-6/+6
2016-04-07fix file postingJosé Bollo2-2/+4
2016-04-07improves file handlingJosé Bollo2-36/+17
2016-04-06upload of filesJosé Bollo2-80/+73
2016-04-06make a sigv even in releaseJosé Bollo1-6/+1
2016-04-05fix context valuesJosé Bollo1-3/+3
2016-04-04work in progress, session handlingJosé Bollo2-6/+6
2016-04-01work in progress (tbf)José Bollo2-65/+93
2016-04-01work in progress (tbf)José Bollo1-7/+11
2016-04-01work in progressJosé Bollo2-15/+21
2016-03-31refactoring (in progress, tbf)José Bollo1-5/+5
2016-03-31refactoring (in progress, tbf)José Bollo2-16/+6
2016-03-30refactoringJosé Bollo3-13/+11
2016 }
<html>
<head>
    <title>tic tac toe</title>
    <style>
	td {
		border: 1px solid black;
		width: 3em;
		height: 3em;
		font-weight: bolder;
		text-align: center;
		align-content: center;
	}
	.button {
		border: 1px solid black;
		border-radius: 5px;
	}
	.button:hover {
		border-width: 2px;
		font-weight: bolder;
	}
    </style>
    <script type="text/javascript" src="AFB.js"></script>
    <script type="text/javascript">
	var afb = new AFB("api", "HELLO");
	var ws;

	function $(x) { return document.getElementById(x); }


	function replyok(obj) {
		$("id").innerHTML = obj.response.boardid;
		var i;
		for (var i = 0 ; i < 9 ; i++)
			$("cell-" + i).innerHTML = obj.response.board[i];
	}
	function replyerr(obj) {
	}
	function gotevent(obj) {
		ws.call("tictactoe/board").then(replyok, replyerr);
	}

	function onopen() {
		$("main").style.visibility = "visible";
		$("connected").innerHTML = "Connected to WebSocket server";
		ws.onevent("tictactoe/board", gotevent);
		ws.call("tictactoe/new").then(gotevent, replyerr);
	}
	function onabort() {
		$("main").style.visibility = "hidden";
		$("connected").innerHTML = "Connected Closed";
	}

	function init() {
		ws = new afb.ws(onopen, onabort);
	}

    </script>

<body onload="init();">
    <h1>Tic Tac Toe</h1>
    <div id="connected">Not Connected</div>
    <div id="main" style="visibility:hidden">
	    <div>board id <span id="id"></span></div>
	    <div>
		    <table>
			    <tr>
				    <td id="cell-0" onclick="javascript: ws.call('tictactoe/move',{'index':0})"> </td>
				    <td id="cell-1" onclick="javascript: ws.call('tictactoe/move',{'index':1})"> </td>
				    <td id="cell-2" onclick="javascript: ws.call('tictactoe/move',{'index':2})"> </td>
			    </tr>
			    <tr>
				    <td id="cell-3" onclick="javascript: ws.call('tictactoe/move',{'index':3})"> </