UNPKG

nsure

Version:

nsure is a JS class that allows deep testing/sanitation, modification chains and model generation of objects.

36 lines (35 loc) 5.44 kB
{ "name": "bubpubsub", "description": "a pubsub system with bubbling, replies and persistence", "url": "http://github.com/itsatony/bubpubsub", "keywords": [ "pubsub", "events", "publish", "subscribe", "bubbling", "persistence", "VisualWeb" ], "author": { "name": "Toni Wagner", "email": "i@itsatony.com" }, "contributors": [], "licenses": [ "free" ], "dependencies": {}, "main": "./lib/bubpubsub", "version": "0.8.7", "directories": { "lib": "./lib" }, "engines": { "node": "> 0.6" }, "readme": "\n# bubPubSub\n\nbubPubSub (VisualWeb's PubSub) is a publish/subscribe system for communication between objects/modules of your code. \nIt's rather similar to common pubSub systems, but closer related to the event system of nodeJS or the browser. USP's are\n\n* (optional) BUBBLING along a topic-tree \n \n* (optional) PERSISTENCE of publications for later retrieval/reference\n\nIt is developed, used and sponsored by myLinkCloud (http://www.mylinkcloud.com), meinUnterricht (http://www.meinUnterricht.de), K.lab (http://www.klab-berlin.com), and ViSERiON (http://www.viserion.com) .\n\n## compatibility\n\n bubPubSub works on both ends, the client and the server (nodeJS).\n\n## Installation with nodeJS\n\n\t $ npm install bubpubsub\n\n## Test (server-side)\n\n\tcd to node_modules/bubpubsub\n\tmake\n\n## VERSION HISTORY:\n\t- v0.8.7 22.11.12\n\t\t- introduced silent option as a per-publication flag to avoice console logging\n\t- v0.8.6 22.11.12\n\t\t- bugFix\n\t- v0.8.6 22.11.12\n\t\t- bugFix\n\t- v0.8.5 19.11.12\n\t\t- bugFixes ..\n\t- v0.8.4 15.11.12\n\t\t- bugFixes ..\n\t\t- old parameters for subscribe will be deprecated announcement\n\t- v0.8.3 15.11.12\n\t\t- introduced autoUnsubscribe to subscribe options ! \n\t\t- optional try-catch around subscribers\n\t\t- scope setting for subscribers\n\t\t- introduced limits for error and publication logs to 10000 items in order to limit memory usage.\n\t- v0.82 28.07.2012\n\t\t- bugfix in chain default and if check. \n\t- v0.81 27.07.12\n\t\t- unsubscribe updated to do a better job of namespace (& memory) cleanup\n\t- v0.80 22.06.12\n\t\t- added the option to do chaining. this needs quite some field-testing ;)\n\t\t- added chainDelay config setting for chained publications to allow breathing-time for the cpu \n\t- v0.71 15.06.12\n\t\t- made the code a bit more beautiful\n\t\t- introduced forceUniqueSubscriber to allow replacing subscriber methods by Id\n\t\t- replaced isFunction method by typeof test \n\t\t- removed randomString method\n\t\t- switched from bad style == to good style === operators... \n\t\t- changed licence\n\t- v0.70 21.03.12\n\t\t- renamed\n\t\t- fused client (jQuery) and server (nodeJS) versions\n\t\t- series of bugfixes\n\t- v0.60\t29.10.11\t\t\t\n\t\t- removed dependencies from jQuery. \n\t\t- enabled using the same file for client- and nodeJS server-side implementation\n\t\t- added the reply function explicitely\n\n## Usage\n\n\tthere is a detailed description of all functions in the source-code ... \n\n## examples (more in the source JS)\n\n\t\t// SUBSCRIPTION TO a deep branch WITHOUT PICKING UP BUBBLES \n \t\tvar myEuropeSubscription = aBubPubSub.subscribe(\n \t\t\t'/politics/europe', \n \t\t\tfunction(data, currentBranch, publisher, replyCall, subscriptionIdObject) { \n \t\t\t\tconsole.log('original publication branch: ' + data.originalTopic); \n\t\t\t\tconsole.log('i subscribed to : ' + currentBranch); \n \t\t\t\treplyCall('I am [' + myEuropeSubscription.id + '] and I am only interested in european politics');\n \t\t\t}, \n \t\t\t{ getBubbles: false } \n \t\t\t'myEuropeSubscriber'\n \t\t);\n\t \n\t // SUBSCRIPTION TO ROOT WITH BUBBLING\n\t var myRootSubscription = aBubPubSub.subscribe(\n \t\t\t'/', \n \t\t\tfunction(data, currentBranch, publisher, replyCall, subscriptionIdObject) { \n \t\t\t\tconsole.log('original publication branch: ' + data.originalTopic); \n\t\t\t\tconsole.log('i subscribed to : ' + currentBranch); \n \t\t\t\treplyCall('I am [' + myRootSubscription.id + '] and I pick up any publication');\n \t\t\t}, \n \t\t\t{ getBubbles: true } \n \t\t\t'myRootSubscriber'\n \t\t);\n\n \t\t// PUBLISH WITH PERSISTANCE AND BUBBLING\n\t\taBubPubSub.publish(\n \t\t\t'/politics/europe/germany/pipa', \n \t\t\t{ \n \t\t\t\tcontent: 'this is wonderfool', \n\t\t\t},\n\t\t\t{ \n\t\t\t\tbubble:true, \n\t\t\t\tpersist:true \n\t\t\t}, \n\t\t\t'myTestPublisher1',\n\t\t\tfunction(replyCallParametersOfYourChoice) {\n\t\t\t\tconsole.dir(replyCallParametersOfYourChoice);\n\t\t\t\treturn true;\n\t\t\t}\n \t\t);\n\t\t\n\t\t// PUBLISH WITH PERSISTANCE AND BUBBLING\n\t\taBubPubSub.publish(\n \t\t\t'/politics/europe/germany/pipa/legislation', \n \t\t\t{ \n \t\t\t\tcontent: 'this can not be picked up by the nonBubbler or the persistence check (below)', \n\t\t\t},\n\t\t\t{ \n\t\t\t\tbubble:true, \n\t\t\t\tpersist:false \n\t\t\t}, \n\t\t\t'myTestPublisher2',\n\t\t\tfunction(replyCallParametersOfYourChoice) {\n\t\t\t\tconsole.dir(replyCallParametersOfYourChoice);\n\t\t\t\treturn true;\n\t\t\t}\n \t\t);\n\t\t\n\t\t\n\t\t// PERSISTANCE\n\t\tvar persistentPublicationObjectArrayOnPolitics = aBubPubSub.wasPublishedOnTopic('/politics', true);\n\t\n\t\t// UNSUBSCRIBE\n\t\taBubPubSub.unsubscribe(myRootSubscription);\n\t\n", "readmeFilename": "README.md", "_id": "bubpubsub@0.8.7", "_from": "bubpubsub@latest" }