www.wrapcode.com Knockout.jsã§å¥ã ã®ViewModeléã§ãã¼ã¿ã®ããã¨ããè¡ãæ¹æ³ãããããªãã£ãã®ã§ 調ã¹ãæãä¸è¨ã®ãµã¤ãã«å種æ¹æ³ãæ¸ãã¦ãã£ãã "ko.subscribable"ã¨ããfunctionãnativeã§ããããã©è©³ããããã¥ã¡ã³ã㯠ãªããããã ãã®functionã使ãæ¹æ³ããããã"knockout-postbox"ã¨ããæ¡å¼µã使ã㨠ããå°ãã·ã³ãã«ã«æ¸ããã GitHub - rniemeyer/knockout-postbox: A small library that uses Knockout's native pub/sub capabilities to facilitate decoupled communication between separate view models or components. ãµã³ã
å°ç²ãªã¢ããªã±ã¼ã·ã§ã³ã°ãããæ¸ãã¦ããã®ã§ãã¯ã©ã¤ã¢ã³ããµã¤ãMVCãå®è£ ãããæãå°ç²ãªã©ã¤ãã©ãªã§ããã¨ããã®Knockout.jsã使ã£ã¦ãã¾ãã Knockout.jsã¯MVVMã®ãã¿ã¼ã³ãæä¾ããã©ã¤ãã©ãªãªã®ã§ãããä»åã¯è©³ç´°ãæ¸ãã¾ããã ç¥ãããæ¹ã¯å ¬å¼ã®ãã¥ã¼ããªã¢ã«ã¨ããã¨ã¦ã親åã§ããæããªã®ã§ããããè¦ããããã®ã§ã¯ãªãã§ããããã ä»åã¯ko.utilsã®è©± ã§ãKnockout.jsã®ããã¥ã¡ã³ãä¸ã§ã¯ç®ç«ããªãã®ã§ãããKnockout.jsã«æ¨æºã§æ·»ä»ãã¦ããko.utilsãå°å³ã«ä¾¿å©ã§ãã ã¾ãjQueryãããã°ã©ãã£ã¦ãã¨ã®ãªãæ©è½ãããã¾ããjQueryã¨åããã¦ä½¿ã£ã¦ããªãå ´åã¨ãã«ã¯é常ã«å©ããã®ã§åå¿é²çã«æ®ãã¾ãã ã¡ãªã¿ã«å ¬å¼ã®ããã¥ã¡ã³ãããããªã³ã¯ããã¦ããKnock Me Outã¨ããããã°ãåèã«ãã¾ããã ã©ã¤ãã©ãªã®ä½è ã®æ¹
Knockoutã®ã³ã³ã»ãã 宣è¨åãã¤ã³ãã£ã³ã° UIã«å¿ è¦ãªã®ã¯ ViewModel (ã·ã³ãã«ãªã¢ãã«ãªãã¸ã§ã¯ã) ã¨ãã¼ã¿ãã¤ã³ãã ãã ãããããDOMæä½ãªãã§ãåçãªã¤ã³ã¿ã¼ãã§ã¤ã¹ãä½ããã¨ãã§ãã¾ãã UIã®èªåæ´æ° ViewModel ã®ããããã£ãå¤æ´ãããã¨ãèªåçã«UIã®é¢é£ä»ããããé¨åãæ´æ°ãã¾ãã ä¾åé¢ä¿ã®ãã©ããã³ã° ãã¼ã¿ã®çµåãå¤æãå®ç¾ããããã®ãã¼ã¿éã®é¢ä¿ãã§ã¼ã³ãæé»çã«è¨å®ãã¾ãã UIãã³ãã¬ã¼ã å¹¾éã«ããã¹ãããããã³ãã¬ã¼ããããã¤ã³ãããã ViewModel ãç¨ãã¦ ç´ æ©ãUIãçæãã¾ãã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}