---
title: "PageBus 页面交互组件间(web版的“JMS”)"
author: "chenlin10058"
date: "2013-05-28T11:33:30Z"
tags: []
categories: ["Web前端"]
slug: "pagebus-web-jms"
draft: false
lastmod: "2013-05-28T11:35:02Z"
id: 1878735
url: "https://chenlin10058.iteye.com/blog/1878735"
---

1 head中引入pagebus.js ()

2 接收订阅

(top.)window.PageBus.subscribe('user.add', this, onUserAddedOrUpdated, null)  ;//最好将订阅事件放在top里面，免得2个页面中的pagebus对象不是同一个对象，那样会接收不到消息的。

 

  function onUserAddedOrUpdated(subj, msg, data) {

   var cId = msg.userId;

   alert(cld)

 }

 

3.发布订阅消息

 (top.)window.PageBus.publish('user.add',{userId:newId});  

 

 

下载地址：[http://developer.tibco.com/gi/product\_resources\_pagebus2.jsp?tab=downloads](http://developer.tibco.com/gi/product_resources_pagebus2.jsp?tab=downloads)

 

还有很多个用法，具体参加下载文件中的demo 和api document .