- 深入理解React Router:從原理到實踐
- 李楊韜
- 100字
- 2021-04-16 16:10:45
2.4.3 history監聽
與browserHistory、hashHistory一樣,memoryHistory也可對location變化進行監聽:

調用history.push、history.replace、history.go分別對應的action為PUSH、REPLACE和POP。
由于內存路由沒有外部的瀏覽器環境,不需要對任何的外部事件進行監聽,所以listen源碼實現可將回調函數存儲到內存數組中即可:

推薦閱讀
- Cocos2d-x游戲開發:手把手教你Lua語言的編程方法
- Learning Bayesian Models with R
- 算法訓練營:提高篇(全彩版)
- Learning ArcGIS for Desktop
- 動手學數據結構與算法
- IDA Pro權威指南(第2版)
- Mastering Elixir
- Practical GIS
- PHP+MySQL動態網站開發從入門到精通(視頻教學版)
- Photoshop智能手機APP界面設計
- 從零學Java設計模式
- 深度學習程序設計實戰
- Android編程權威指南(第4版)
- Laravel Design Patterns and Best Practices
- Python程序設計:基礎與實踐