Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removing the compatibility-oriented packages.

Added a section to the README regarding dependencies (JSON & ES5).
  • Loading branch information...
commit 62cdc43bbd65d66ce4fb0149cd118f8c2c201522 1 parent 3a93793
@markfinger authored
Showing with 11 additions and 24 deletions.
  1. +0 −6 ES5.js
  2. +11 −0 README.md
  3. +0 −16 fc.compatibility-build.min.js
  4. +0 −2  fc.min.js
View
6 ES5.js
@@ -1,6 +0,0 @@
-// Fat Controller - a publish-subscribe service in JS
-// https://github.com/markfinger/fatcontroller
-
-// ES5 polyfills from MDN
-Array.prototype.forEach||(Array.prototype.forEach=function(e,g){var b,a;if(null==this)throw new TypeError("this is null or not defined");var c=Object(this),d=c.length>>>0;if("[object Function]"!={}.toString.call(e))throw new TypeError(e+" is not a function");g&&(b=g);for(a=0;a<d;){var f;a in c&&(f=c[a],e.call(b,f,a,c));a++}});
-Array.prototype.filter||(Array.prototype.filter=function(e,g){if(null==this)throw new TypeError;var b=Object(this),a=b.length>>>0;if("function"!=typeof e)throw new TypeError;for(var c=[],d=0;d<a;d++)if(d in b){var f=b[d];e.call(g,f,d,b)&&c.push(f)}return c});
View
11 README.md
@@ -17,6 +17,7 @@ A publish-subscribe messaging system in Javascript, which:
- [Message Syntax](#message-syntax)
- [Message Objects](#message-objects)
- [Registry of Subscribers](#registry)
+- [Dependencies](#dependencies)
Basic Example
@@ -135,3 +136,13 @@ by the message (namespace and event) they are listening for.
- ``callback`` the function executed when a matching message is published.
- ``identifier`` any identifier fragment contained within the subscribed message.
- ``thisArg`` assigned as the 'this' object of ``callback``.
+
+Dependencies
+--------------------------------------------------
+
+Fat Controller requires [JSON encoding and decoding](http://en.wikipedia.org/wiki/JSON#Native_encoding_and_decoding_in_browsers)
+and ES5's `Array.forEach` and `Array.filter`. If support for legacy browsers is
+required, [Douglas Crockford's json2.js](https://github.com/douglascrockford/JSON-js/)
+and an [ES5 shim](https://github.com/kriskowal/es5-shim/) are recommended.
+
+
View
16 fc.compatibility-build.min.js
@@ -1,16 +0,0 @@
-// Fat Controller - a messaging/signalling service in JS
-// https://github.com/markfinger/fatcontroller
-
-// This is a compatibility-oriented build of Fat Controller, it includes:
-// - Douglas Crockford's json2.js
-// - ES5.js
-// - fc.js
-
-var JSON;JSON||(JSON={});(function(){function k(a){return 10>a?"0"+a:a}function o(a){p.lastIndex=0;return p.test(a)?'"'+a.replace(p,function(a){var c=r[a];return"string"===typeof c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function m(a,j){var c,d,h,n,g=e,f,b=j[a];b&&("object"===typeof b&&"function"===typeof b.toJSON)&&(b=b.toJSON(a));"function"===typeof i&&(b=i.call(j,a,b));switch(typeof b){case "string":return o(b);case "number":return isFinite(b)?""+b:"null";case "boolean":case "null":return""+b;case "object":if(!b)return"null";e+=l;f=[];if("[object Array]"===Object.prototype.toString.apply(b)){n=b.length;for(c=0;c<n;c+=1)f[c]=m(c,b)||"null";h=0===f.length?"[]":e?"[\n"+e+f.join(",\n"+e)+"\n"+g+"]":"["+f.join(",")+"]";e=g;return h}if(i&&"object"===typeof i){n=i.length;for(c=0;c<n;c+=1)"string"===typeof i[c]&&(d=i[c],(h=m(d,b))&&f.push(o(d)+(e?": ":":")+h))}else for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(h=m(d,b))&&f.push(o(d)+(e?": ":":")+h);h=0===f.length?"{}":e?"{\n"+e+f.join(",\n"+e)+"\n"+g+"}":"{"+f.join(",")+"}";e=g;return h}}"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var q=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,p=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e,l,r={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},i;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,j,c){var d;l=e="";if(typeof c==="number")for(d=0;d<c;d=d+1)l=l+" ";else typeof c==="string"&&(l=c);if((i=j)&&typeof j!=="function"&&(typeof j!=="object"||typeof j.length!=="number"))throw Error("JSON.stringify");return m("",{"":a})});"function"!==typeof JSON.parse&&(JSON.parse=function(a,e){function c(a,d){var g,f,b=a[d];if(b&&typeof b==="object")for(g in b)if(Object.prototype.hasOwnProperty.call(b,g)){f=c(b,g);f!==void 0?b[g]=f:delete b[g]}return e.call(a,d,b)}var d,a=""+a;q.lastIndex=0;q.test(a)&&(a=a.replace(q,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){d=eval("("+a+")");return typeof e==="function"?c({"":d},""):d}throw new SyntaxError("JSON.parse");})})();
-
-Array.prototype.forEach||(Array.prototype.forEach=function(e,g){var b,a;if(null==this)throw new TypeError("this is null or not defined");var c=Object(this),d=c.length>>>0;if("[object Function]"!={}.toString.call(e))throw new TypeError(e+" is not a function");g&&(b=g);for(a=0;a<d;){var f;a in c&&(f=c[a],e.call(b,f,a,c));a++}});
-Array.prototype.filter||(Array.prototype.filter=function(e,g){if(null==this)throw new TypeError;var b=Object(this),a=b.length>>>0;if("function"!=typeof e)throw new TypeError;for(var c=[],d=0;d<a;d++)if(d in b){var f=b[d];e.call(g,f,d,b)&&c.push(f)}return c});
-
-window.fc=function(){function g(a){c[a.name].forEach(function(b){void 0!==b.thisArg?b.callback.call(b.thisArg,JSON.parse(JSON.stringify(a))):b.callback(JSON.parse(JSON.stringify(a)))});return a}function d(a){if("string"!=typeof a)throw new TypeError("fc._checkMessage: `message` must be a string.");if(!/^[a-z0-9_/ /:/-]+$/i.test(a))throw Error("fc._checkMessage: `message` must be a string containing at least one character, and composed only of alphanumeric characters, underscores, spaces, colons, and dashes.");
-if(3<a.split(":").length)throw Error("fc._checkMessage: `message` may contain at most three colons, example: `namespace:event:identifier`.");var b=a.split(":"),a=1==b.length?a:b[0]+":"+b[1];return a}function e(a){a=a.split(":");if(3==a.length)return a[2]}var c={};return{publish:function(a,b){var c=d(a),f=(new Date).getTime(),i=e(a);if(!(void 0===b||"object"==typeof b))throw new TypeError("fc._checkData: `data` must be either undefined or an object.");return g({name:c,timestamp:f,identifier:i,data:b})},
-subscribe:function(a,b,h){var f=d(a);if("function"!=typeof b)throw new TypeError("fc._checkCallback: `callback` must be a function.");a={messageName:f,callback:b,identifier:e(a),thisArg:h};(b=c[a.messageName])||(b=c[a.messageName]=[]);b.push(a);return a},unsubscribe:function(a){var b=e(a),a=d(a);b&&(c[a]=c[a].filter(function(a){return a.identifier!=this},b));(!b||!c[a].length)&&delete c[a];return a},registry:function(){return c}}}();
View
2  fc.min.js
@@ -1,8 +1,6 @@
// Fat Controller - a messaging/signalling service in JS
// https://github.com/markfinger/fatcontroller
-// Minified version of fc.js
-
window.fc=function(){function g(a){c[a.name].forEach(function(b){void 0!==b.thisArg?b.callback.call(b.thisArg,JSON.parse(JSON.stringify(a))):b.callback(JSON.parse(JSON.stringify(a)))});return a}function d(a){if("string"!=typeof a)throw new TypeError("fc._checkMessage: `message` must be a string.");if(!/^[a-z0-9_/ /:/-]+$/i.test(a))throw Error("fc._checkMessage: `message` must be a string containing at least one character, and composed only of alphanumeric characters, underscores, spaces, colons, and dashes.");
if(3<a.split(":").length)throw Error("fc._checkMessage: `message` may contain at most three colons, example: `namespace:event:identifier`.");var b=a.split(":"),a=1==b.length?a:b[0]+":"+b[1];return a}function e(a){a=a.split(":");if(3==a.length)return a[2]}var c={};return{publish:function(a,b){var c=d(a),f=(new Date).getTime(),i=e(a);if(!(void 0===b||"object"==typeof b))throw new TypeError("fc._checkData: `data` must be either undefined or an object.");return g({name:c,timestamp:f,identifier:i,data:b})},
subscribe:function(a,b,h){var f=d(a);if("function"!=typeof b)throw new TypeError("fc._checkCallback: `callback` must be a function.");a={messageName:f,callback:b,identifier:e(a),thisArg:h};(b=c[a.messageName])||(b=c[a.messageName]=[]);b.push(a);return a},unsubscribe:function(a){var b=e(a),a=d(a);b&&(c[a]=c[a].filter(function(a){return a.identifier!=this},b));(!b||!c[a].length)&&delete c[a];return a},registry:function(){return c}}}();
Please sign in to comment.
Something went wrong with that request. Please try again.