2013-03-23 5 views
1

내가 업데이트하는 일부 오래된 코드가 있으며 클리너가이 코드를 선택하지 않습니다.on.event.remove에 해당하는 스트림은 무엇입니까?

나는 변화에 성공한 다음

document.on.mouseOut.add(onDocumentMouseOut); 

document.onMouseOut.listen(onDocumentMouseOut); 

에하지만이 번역하는 방법을 모른다 :

document.on.mouseOut.remove(onDocumentMouseOut); 

제거의 흐름 상응하는 무엇을 ?

답변

3

listen()에 의해 반환 된 StreamSubscription 개체에 대한 참조를 유지하고 그것에 cancel() 메서드를 호출하십시오.

// Add a handler 
var subscription = document.onMouseOut.listen((e) => print('oi')); 

// Remove the handler 
subscription.cancel(); 
관련 문제