0.1.8 • Published 12 years ago
tart-revocable v0.1.8
tart-revocable
Stability: 1 - Experimental
Implementation of a revocable proxy for Tiny Actor Run-Time in JavaScript.
Contributors
Overview
An implementation of a revocable proxy.
Usage
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);Tests
npm testDocumentation
Public API
revocable.proxy(actor)
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 theactorit 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 thecustomerupon revocation.
