ryanflorence / publisher.js Goto Github PK
View Code? Open in Web Editor NEWPublish / Subscribe for JavaScript
Home Page: http://rpflorence.github.com/publisher.js
Publish / Subscribe for JavaScript
Home Page: http://rpflorence.github.com/publisher.js
When run as an AMD module and optimized by @jrburke 's RequireJS, Publisher fails to be defined as a module. Instead an empty define('publisher', function(){})
is produced, breaking any code Publisher-dependent code.
Quoting @jrburke from ded/morpheus#19 , in which an identical problem and its solution are discussed:
The issue is that the requirejs optimizer uses an AST to find define() calls that look like AMD define calls. Since define(definition) is a bit too generic it skips it and puts in an empty module for the 'morpheus' name.
Two possible easy fixes:
- Use a function literal:
if (typeof define == 'function') define(function(){return definition()})
- Or just pass name to the function:
if (typeof define == 'function') define(name, definition)
Whats currently missing is a way to subscribe to all messages of a topic or even all messages flowing to publisher to log them. This could be useful for automatically do something with sub topics which the system dosent know before.
An possible way to do this, would be something like that:
publisher.subscribe('sensors/*', function(data){
..
});
Please say it isn't so
the registration of an after
callback is currently function(returnValue, object)
, ideally it should be something like function(returnValue, object, arg1, arg2, โฆ)
so that you can access the arguments without having to also create a before and cache them.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.