Changes between Version 16 and Version 17 of jazz/ActiveMQ/08-10-27


Ignore:
Timestamp:
Oct 28, 2008, 1:52:12 PM (16 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • jazz/ActiveMQ/08-10-27

    v16 v17  
    9393 * 其中 prototype.js 跟 behaviour.js 都是跟 AJAX 與 CSS 相關的 !JavaScript Framework
    9494   * prototype.js - [http://www.prototypejs.org/ Prototype JavaScript framework], version 1.4.0 - 目前已經是 1.6.0.3 版了!
    95  * 剩下 portfolio.js 跟 _amq.js 是比較重要的兩個 script.
     95 * 剩下 portfolio.js 跟 _amq.js 是比較重要的兩個 script. 首先來看 portfolio.js
     96{{{
     97#!java
     98// 註冊 PollHandler
     99// 參考: _amq.js - addPollHandler : function(func)
     100//              * func: 函數指標(Function Pointer)
     101amq.addPollHandler(portfolioPoll);
     102
     103// 這裡的 first 定義在 _amq.js 裡,預設值 _first: true
     104function portfolioPoll(first)
     105{
     106   if (first)
     107   {
     108     // 參考: _amq.js - addListener : function(id,destination,handler)
     109     //              * id: Handler id
     110     //              * destination: Listen to a Message Channel or Topic
     111     //              * handler: 函數指標, 發生事件時的 callback 函數, 必須能處理 message 函數
     112     amq.addListener('stocks','topic://STOCKS.*',priceHandler._price);
     113   }
     114}
     115
     116// priceHandler 類別的 _price 函數宣告
     117var priceHandler =
     118{
     119  _price: function(message)
     120  // 剩下的部份就是在處理 message 中的資料,忽略不看
     121}
     122}}}