Edit in JSFiddle

var topics = {};

$.weixin = function( id ) {
    var callbacks,
        method,
        topic = id && topics[ id ];

    if ( !topic ) {
        callbacks = $.Callbacks();
        topic = {
            publish: callbacks.fire,
            // 调用subscribe 将订阅回调函数存放在当前topic_list中
            subscribe: callbacks.add,
            unsubscribe: callbacks.remove
        };
        if ( id ) {
            topics[ id ] = topic;
        }
    }
    return topic;
};

// 小王订阅
$.weixin( "js" ).subscribe(function(data) {
    console.log('小王收到的内容:' + data);
});
// 小王的儿子订阅
$.weixin( "js" ).subscribe(function(data) {
    console.log('小王儿子收到的内容:' + data);
});
// 小李订阅
$.weixin( "nodejs" ).subscribe(function(data) {
    console.log('小李收到的内容:' + data);
});

// 发布
$.weixin( "js" ).publish( "Hello js!" );
$.weixin( "nodejs" ).publish( "Hello nodejs!" );
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.0.0.js"></script>
<meta name="description" content="博客 - jquery callback发布订阅模式1">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>

</body>
</html>