Stability: 1 - Experimental
Implementation of a revocable proxy for Tiny Actor Run-Time in JavaScript.
An implementation of a revocable proxy.
To run the below example run:
npm run readme
"use strict";
var revocable = require('../index.js'),
tart = require('tart');
var sponsor = tart.minimal();
var actorBeh = function actorBeh(message) {
console.log(message);
};
var actor = sponsor(actorBeh);
var capabilities = revocable.proxy(actor);
var proxy = sponsor(capabilities.proxyBeh);
proxy('hello');
proxy('revocable');
proxy('world');
var revoke = sponsor(capabilities.revokeBeh);
var ackCustomer = sponsor(function ackCustomerBeh() {
console.log('revoke acked');
proxy('this');
proxy('does not get through');
});
revoke(ackCustomer);
npm test
Public API
actor
: Actorfunction (message) {}
Actor to create a revocable proxies for.- Return: Object An object containing behaviors for revocable proxies and a revoke capabilities for the proxies.
proxyBeh
: Actorfunction (message) {}
Actor behavior that will forward all messages to theactor
it is a proxy for.revokeBeh
: Actorfunction (customer) {}
Actor behavior that upon receipt of a message will revoke all proxies for theactor
.customer
: Actorfunction () {}
An ack will be sent to thecustomer
upon revocation.