This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function.prototype.notifier = (function () {"use strict"; | |
| // (C) WebReflection - Mit Style License | |
| function create(callback) { | |
| function notifier() { | |
| var args = [].slice.call(arguments), output; | |
| if (fire(notifier, "before", callback, this, args, null)) { | |
| try { | |
| output = callback.apply(this, args); | |
| } catch(e) { | |
| fire(notifier, "error", callback, this, args, e); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function () { | |
| // Andrea Giammarchi - Mit Style License | |
| // note: it's not production ready | |
| function dispatch(callback) { | |
| callback.call(this.r, this.e); | |
| } | |
| function add(callback) { | |
| this.handlers.indexOf(callback) < 0 && |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>wru</title> | |
| <!-- https://github.com/WebReflection/wru --> | |
| <script src="define.js"></script> | |
| <script>function wru(wru){var assert=wru.assert,async=wru.async; | |
| // enojy your tests! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function (Object) { | |
| /** | |
| * @name Object.prototype.define | |
| * @description A simplified and intuitive way to define objects properties. | |
| * @requires Object.defineProperty, Array.prototype.forEach (native or shimmed) | |
| * @author Andrea Giammarchi (@WebReflection) | |
| * @license Mit Style | |
| */ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // could be used to inspect objects runtime | |
| // e.g. with IDE for suggestion | |
| // requires a modern JS engine in the IDE | |
| var properties = function ( | |
| getNames, // alias Object.getOwnPropertyNames | |
| getDescriptor,// alias Object.getOwnPropertyDescriptor | |
| has, // alias {}.hasOwnProperty | |
| toString // alias Function.prototype.toString | |
| ) { | |
| // (C) WebReflection - Mit Style License |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var module = (function create( | |
| namespace, handler, module, Proxy | |
| ) { | |
| // ------------------------------------ | |
| // (C) WebReflection - MitStyle License | |
| // ------------------------------------ | |
| // @dependency npm install node-proxy | |
| // ------------------------------------ | |
| // var sys = module.sys; | |
| // sys.print("it works!"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.retrieveSelector = (function (filter) { | |
| // (C) WebReflection - Mit Style License | |
| function elementsOnly(element) { | |
| return element.nodeType == 1; | |
| } | |
| function createSelector(element, documentElement, path, first) { | |
| var |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.createElement = function ( | |
| createElement, // the native one | |
| createResponse // the function "in charge" | |
| ) { | |
| return function (nodeName) { | |
| var result, src; | |
| // if we are creating a script | |
| if (/^script$/i.test(nodeName)) { | |
| // result will be a place holder | |
| result = createElement.call( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function track(object) { | |
| // how to track old libraries, by Andrea Giammarchi | |
| // var report = track(genericObject); | |
| // ... run whatever you run usually ... | |
| // console.log(report); | |
| function createGetterSetterIfNecessary(key) { | |
| return hasOwnProperty.call(result, key = key.slice(1)) ? | |
| result[key] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(Object, String){ | |
| // (C) WebReflection - Mit Style License | |
| // @about implementing "in" operator as generic object method | |
| // returns primitive value or object itself | |
| function toValue(obj) { | |
| switch (true) { | |
| case isInstanceOf(obj, Boolean): | |
| case isInstanceOf(obj, Number): |