Jason Butz

Passionate about the web; enjoys JavaScript more than is probably reasonable; loves learning new things; Sr. Software Engineer @ Genesys

Knockout Observables & Maps

August 29, 2017 in #Knockout.js

I've used Knockout.js quite a bit, I was looking at some code and come across an interesting situation. I saw a JS Map object being put into a KO observable which got me thinking. Does Knockout actually support that? Will subscriptions trigger? I hypothesized that they would not, but I had to test it.

See the Pen KO Observables - Maps by Jason Butz (@jasonbutz) on CodePen.

Turns out Knockout doesn't detect changes to the Map, just like if you edit an object contained in an observable the change won't be detected.

Share on Google+