Added tutorial and session mechanism
diff --git a/public/js/demo/session.html b/public/js/demo/session.html
new file mode 100644
index 0000000..59cfe4f
--- /dev/null
+++ b/public/js/demo/session.html
@@ -0,0 +1,44 @@
+ <!DOCTYPE html>
+<html>
+ <head>
+ <title>Cookie demo</title>
+ <script src="../src/session.js"></script>
+ <script>
+
+var cookey;
+
+function add (val) {
+ var list = document.getElementById('number');
+ list.textContent += '-' + val;
+ cookey.set('n', list.textContent);
+};
+
+function removeCookie () {
+ cookey.clear();
+};
+
+document.addEventListener('DOMContentLoaded', function () {
+ cookey = KorAP.Session.create('peter');
+ document.getElementById('number').textContent = cookey.get('n') || '';
+
+ var elements = document.getElementsByClassName('num');
+ for (var i = 0; i < elements.length; i++) {
+ elements[i].addEventListener(
+ 'click',
+ function (e) {
+ add(this.textContent);
+ }
+ );
+ };
+});
+
+ </script>
+ </head>
+ <body>
+ <div id="number"></div>
+ <span class="num">1</span>
+ <span class="num">2</span>
+ <span class="num">3</span>
+ <div onclick="removeCookie()">remove</div>
+ </body>
+</html>