Proxy questions

Kevin Smith khs4473 at gmail.com
Sun Jan 20 15:52:01 PST 2013


Let me correct a typo in that last one:

    var blackHolePurse = new Purse();

    var blackHole = new Proxy(blackHolePurse, {

        get: function(obj, name) {

            if (name === "somethingInocuous") throw new Error("Up in
smoke!");
            return obj[name];
        }
    });

    try { blackHole.deposit(1000, myPurse); }
    catch (x) { /* Oops - $1000 just disappeared from existence. */ }

Again - more foolish than evil.  : )

{ Kevin }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130120/bad64261/attachment.html>


More information about the es-discuss mailing list