Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

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

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

Avatar for Kazuhito Hokamura

Kazuhito Hokamura

December 18, 2014
Tweet

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]