From 879e2425b9d20030d0f0a92452ccf1b9227fd790 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Wed, 11 May 2016 22:13:35 -0400 Subject: [PATCH] Make Anchor.prototype.context n-ary --- js/examples/chat/index.js | 2 +- js/src/ui.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/js/examples/chat/index.js b/js/examples/chat/index.js index 881606e..2d4f608 100644 --- a/js/examples/chat/index.js +++ b/js/examples/chat/index.js @@ -33,7 +33,7 @@ function spawnChatApp() { assert toBroker(url, present(this.nym, this.status)); during fromBroker(url, present($who, $status)) { - assert ui.context(who) + assert ui.context(who, status) .html('#nymlist', Mustache.render($('#nym_template').html(), { who: who, status: status })); } diff --git a/js/src/ui.js b/js/src/ui.js index 3eed014..3cd12a0 100644 --- a/js/src/ui.js +++ b/js/src/ui.js @@ -337,8 +337,9 @@ function Anchor(explicitFragmentId) { this.eventPattern = uiEvent(this.fragmentId, __, __, __); } -Anchor.prototype.context = function (contextId) { - return new Anchor(this.fragmentId + '_' + escapeDataAttributeName(contextId)); +Anchor.prototype.context = function (/* ... */) { + var extn = Array.prototype.slice.call(arguments).map(escapeDataAttributeName).join('__'); + return new Anchor(this.fragmentId + '__' + extn); }; Anchor.prototype.html = function (selector, html) {