From 066920b771c554dc853c966a96dbb980949d737d Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sun, 11 Nov 2018 13:59:01 +0000 Subject: [PATCH] Allow Dataspace subclasses to extend endpoint-addition behaviour --- packages/core/src/dataspace.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/core/src/dataspace.js b/packages/core/src/dataspace.js index 2cb2309..04635fb 100644 --- a/packages/core/src/dataspace.js +++ b/packages/core/src/dataspace.js @@ -238,6 +238,9 @@ Dataspace.prototype.unsubscribe = function (handler) { this.index.removeHandler(handler, handler.callback); }; +Dataspace.prototype.endpointHook = function (facet, endpoint) { +}; + function Actor(dataspace, name, initialAssertions) { this.id = dataspace.nextId++; this.dataspace = dataspace; @@ -554,7 +557,9 @@ Facet.prototype.addStopScript = function (s) { }; Facet.prototype.addEndpoint = function (updateFun, isDynamic) { - return new Endpoint(this, isDynamic === void 0 ? true : isDynamic, updateFun); + const ep = new Endpoint(this, isDynamic === void 0 ? true : isDynamic, updateFun); + this.actor.dataspace.endpointHook(this, ep); + return ep; }; Facet.prototype.addDataflow = function (subjectFun, priority) {