Error().stack : Error
at https://imma.neocities.org/misc:533:38 function getStack() { return Error().stack.replace(/^(.|\n)*at getStack(.|\n)*?at /, "") } function bob() { return jim(); } function jim() { return getStack()} bob() produces : jim (https://imma.neocities.org/misc:532:26) at bob (https://imma.neocities.org/misc:531:26) at https://imma.neocities.org/misc:537:46
1000002000005000000400000300000200001 x 1000002000005000000400000300000200001 (built in multiplication causes quite a big rounding error) : = 1.000004000014e+72 = 1.000004000014e+72
var s = ([]+![])[+!+[]+!+[]+!+[]][([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([][([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+![])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]]+([]+!![])[+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+!![])[+!+[]]][([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+![])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]]+([]+!![])[+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+!![])[+!+[]]](([]+!![])[+!+[]]+([]+[][+[]])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]+!+[]]+([]+!![])[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[])[([]+{})[+!+[]+!+[]+!+[]+!+[]+...
s ... = Strange thing
function evnt(s,i){s=[];return{sub:function(h){s.push(h)},go:function(p){for(i=s.length;i--;)s[i](p)}}}
simple:
function newSimpleEvent() { return {/*
simple public event pattern
unsubscribe must be done manually,
subscribers list is visible(pro/con?) */
subscribers: [],
subscribe: function (handler) { this.subscribers.push(handler) },
fire: function newEvent_Fire() { for (var h = this.subscribers.length; h--;) this.subscribers[h].apply(this, arguments) } } }
full:
function newEvent(name, arguments) {/*
event pattern
with private subscribers,
unsubscribing,
bound 'fire' & 'subscribe' functions (can be localised and still connect),
optional logging with default built-in logger */
var subscribers = [],
event = {
name: name || "unnamed event - " + Date(),
arguments: arguments || "unknown",
subscribe: newEvent_Subscribe,
fire: newEvent_Fire,
unsubscribe: newEvent_Unsubscribe };
if (log) log("created event '" + name + "' (" + arguments + "), " + log);
return event;
function newEvent_Subscribe (handler) {
if (log) log("added subscriber to event '" + event.name + "' : " + handler);
subscribers.push(handler); }
function newEvent_Fire () {
if (log) log("firing event '" + event.name + "' (" + JSON.stringify([].slice.call(arguments)).slice(1,-1) + ")");
for (var h = subscribers.length; h--;) subscribers[h].apply(event, arguments); }
function newEvent_Unsubscribe (handler) {
if (log) log("removing subscriber to " + event.name + " : " + handler);
subscribers.splice(subscribers.indexOf(handler), 1); } }
egs:
{"events":{},"state":"not connected","server":"none"}
{"newEmail":{"name":"email arrived","arguments":"email object"},"connected":{"name":"connected to server","arguments":"server ip"},"disconnected":{"name":"disconnected from server","arguments":"server ip"},"state":"not connected","server":"none"}