annotate web/views/riot.min.js @ 556:c5f8375b12a2

long polling works
author Matt Johnston <matt@ucc.asn.au>
date Tue, 09 Jun 2015 23:27:44 +0800
parents 9950ffa9a79b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
482
9950ffa9a79b set nearly working
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 /* Riot 0.9.8, @license MIT, (c) 2014 Moot Inc + contributors */
9950ffa9a79b set nearly working
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 (function(e){"use strict";e.observable=function(e){var t={},n=[].slice;e.on=function(n,r){if(typeof r==="function"){n.replace(/[^\s]+/g,function(e,n){(t[e]=t[e]||[]).push(r);r.typed=n>0})}return e};e.off=function(n){n.replace(/[^\s]+/g,function(e){t[e]=[]});if(n=="*")t={};return e};e.one=function(t,n){if(n)n.one=true;return e.on(t,n)};e.trigger=function(r){var o=n.call(arguments,1),u=t[r]||[];for(var i=0,a;a=u[i];++i){if(!(a.one&&a.done||a.busy)){a.busy=true;a.apply(e,a.typed?[r].concat(o):o);a.done=true;a.busy=false}}return e};return e};var t={};var n={"\\":"\\\\","\n":"\\n","\r":"\\r","\u2028":"\\u2028","\u2029":"\\u2029","'":"\\'"};var r={"&":"&amp;",'"':"&quot;","<":"&lt;",">":"&gt;"};e.render=function(e,r){if(!e)return"";t[e]=t[e]||new Function("_","return '"+e.replace(/[\\\n\r\u2028\u2029']/g,function(e){return n[e]}).replace(/\{\s*(\w+)\s*\}/g,"'+(_.$1?(_.$1+'').replace(/[&\"<>]/g,function(e){return ENTITIES_MAP[e];}):(_.$1===0?0:''))+'")+"'");return t[e](r)};if(typeof top!="object")return;var o,u=e.observable({}),i=window.addEventListener,a=document;function f(e){e=e.type?location.hash:e;if(e!=o)u.trigger("pop",e);o=e}if(i){i("popstate",f,false);a.addEventListener("DOMContentLoaded",f,false)}else{a.attachEvent("onreadystatechange",function(){if(a.readyState==="complete")f("")})}e.route=function(e){if(typeof e==="function")return u.on("pop",e);if(history.pushState)history.pushState(0,0,e);f(e)}})(typeof top=="object"?window.$||(window.$={}):exports);