2013-06-21 44 views

回答

0

只是帶有事件監聽器的design your own widget。並在您的自定義小部件類ovveride中加載和卸載方法。

// This method is called when a widget is attached to the browser's document 
    @Override 
    protected void onLoad() { 
    setEventListener(inputElem, this); 
    // ... 
    } 


    // This method is called when a widget is detached from the browser's document 
    @Override protected void onUnload() { 
    // Clear out the inputElem's event listener (breaking the circular 
    // reference between it and the widget); avoid memory leaks 
    setEventListener(inputElem, null); 
    // ... 
    } 
+0

爲什麼你會混淆事件監聽器來存儲值?這個工作已經由'onAttach'完成了,它調用onLoad(和'onDetach',它調用'onUnload')。 –

相關問題