0.1.8 • Published 10 years ago

tart-revocable v0.1.8

Weekly downloads
2
License
-
Repository
github
Last release
10 years ago

tart-revocable

Stability: 1 - Experimental

NPM version

Implementation of a revocable proxy for Tiny Actor Run-Time in JavaScript.

Contributors

@dalnefre, @tristanls

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 test

Documentation

Public API

revocable.proxy(actor)

  • actor: Actor function (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: Actor function (message) {} Actor behavior that will forward all messages to the actor it is a proxy for.
    • revokeBeh: Actor function (customer) {} Actor behavior that upon receipt of a message will revoke all proxies for the actor.
      • customer: Actor function () {} An ack will be sent to the customer upon revocation.

Sources

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago