Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Direct ProxiesでObject.observeの Polyfillはできるのか

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

Direct ProxiesでObject.observeの Polyfillはできるのか

Avatar for Kazuhito Hokamura

Kazuhito Hokamura

December 18, 2014

More Decks by Kazuhito Hokamura

Other Decks in Programming

Transcript

  1. Direct Proxies var proxy = new Proxy(obj, {
 set(target, name,

    val, receiver) { // do something
 } }); • objΛҾ਺ͱͯ͠৽ͨͳ୅ཧΦϒδΣΫτʢproxyʣΛಘΔ • proxyΛૢ࡞ͨ࣌͠ʹhandler͕ݺ͹ΕΔ • objΛૢ࡞ͯ͠΋handler͸ݺ͹Εͳ͍
  2. ͳΜ͔ΤϥΔɾɾ // Firefox 36.0 Observer(Object); // enable polyfill var obj

    = {}; Object.observe(obj, handler); //=> uncaught exception: can only get notifier of observable objects, given [object Object]