Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     run = function(what, using) { var nothing = Symbol('void:nothing'), _undefined = Symbol('void:undefined'), empty = Symbol('void:empty'), _null = Symbol('void:null'), fatal = Symbol('error:fatal') ; var runner = null, slip = function(data) { if(typeof data.return === 'undefined') { data.return = _undefined } ; _arguments.push(data.argument), _returns.push(data.return), _runs.push(that.last = _last = +new Date()); return data.return }, init = +new Date(), that = (this === window ? {} : this), binder = function(handle, fn, arg) { let bound = _this[handle]; if(typeof fn == 'function') bound = method[handle].handler = fn ; return bound.bind(null, arg||that.this) }, callee = function(arg, fn, args) { if(valid(arg)) { if(arguments.length === 1) { fn = arg['function'], args = arg['argument'] } else { if(typeof fn != 'function') { throw(new Error('Invalid Fn')); return false } } } else { arg = that.this; if(!valid(arg)) { throw(new Error('Invalid Arg')); return false } } ; arg['return'] = nothing ; return arg['return'] = slip( { argument: args, return: fn(args), promise: /* new Promise()|| */{}, callback: { exit: ()=>{}, done: ()=>{ return { success: null, failure: null, warning: null, nothing: null, cancelled: false, reversed: false, cached: false, created: true /* <- flags and handlers for different cases; reversed and cancelled for undo/redo, cached and created for caching functionality */ } }, error: ()=>{} }, thread: /* new Worker()|| */function() { /* worker shim */ } } ) }, _this = {
  2.             _auto : function(arg, ...s) { return _this[_this['_dflt']](arg||this, ...s) },
  3.             guess : function(arg, ...s) { /* guesses from arg.function type, validates via valid(arg.argument) */ },
  4.             catch : function(arg, ...s) { try { return callee(arg||this) } catch(e) { console.error(e) } },
  5.             basic : function(arg, ...s) { return callee(arg||this) },
  6.             query : function(arg, ...s) { /* queryselector dom element attribute getter & setter */ },
  7.             evals : function(arg, ...s) { var arg = arg||this; try { return callee(arg, eval, '('+arg['argument']+')()' ) } catch(e) { if(!e instanceof TypeError ) { console.error('error :' + e); console.dir(e) } else { console.error(e) } } },
  8.             temps : function(arg, ...s) { /* tempate strings */ },
  9.             regex : function(arg, ...s) { /* regular expressions */ },
  10.             works : function(arg, ...s) { /* worker threads, ajax & async */ },
  11.             _dflt : 'catch'
  12.         } , manager = function() {}, handler = function(h) { return runner = binder(h||'_auto') }, run = function() { return runner() }, valid = function(arg, ...param) { if(typeof arg == 'object' && arg != null) { if(typeof arg['function'] == 'function') { if(! (typeof arg['argument'] == 'string' || typeof arg['argument'] == 'object') ) { arg['argument'] = {} } } else { console.error(2); return false } return true ; } else { console.error(1); return false } /* switch(typeof param) {} */ } , looper = null, worker = null , _defaults = (typeof using == 'object' ? using : { timeout : using } ) ,
  13.         argument = using, _runs = [], _arguments = [], _returns = [], _last = null ; that.this = { function: what, argument: argument, callee: callee } ; handler('_auto') ; if(typeof what == 'string') that.this['argument'] = argument = what, that.this['function'] = what = handler('evals') ; if(typeof what != 'function') return false; else run(), last = +new Date; return that.when = function (triggered = true) { return true; }, that.until = function(condition = true) { return false; }, that.catch = { 'all': true, errors: [ { like: '/* (a list of) (an) error object(s) or (a) string(s) */', handlers: [ { with: function() { /* error handling method */ }, on: { conditions: [ '/* list of conditions */' ] } } ] } ] }, that.debug = console, that.using = { environment: that.debug, default: _defaults, configuration: '/* production, development, debugging */', parameters: arguments, timeout: _defaults.timeout, interval: _defaults.interval }, that.remap = { /* using parameters remap */ }, that.name = name||'/* generated mnemonic name */', that.symbol = Symbol(name), that.uuid = '/* generated uuid */', that.qs = '/* plain hash querystring */', that.hash = '/* md5 from an ordered hash querystring */', that.id = '/* id generated from mnemonic name and/or uuid (and/or symbol)', that.er = { handler: handler, manager: manager, runner: runner }, that.run = run, that.last = _last, that.stamps = { initialized: init, constructed: +new Date(), runs: _runs }, that.data = { argument: _arguments, returns: _returns },  that; }   ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement