Socket
Book a DemoInstallSign in
Socket

@ao-framework/portals

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ao-framework/portals

Portals is a library for dealing with asynchronous event-driven architecture in two ways. The first is the run-of-the-mill event bus with a different way of handling context. The second provides a way of declaring services with multiple endpoints for thos

0.0.1
latest
npmnpm
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source


Portals

Currently in early development. Breaking changes will occur frequently.

Portals is a library for dealing with asynchronous event-driven architecture in two ways. The first is the run-of-the-mill event bus with a different way of handling context. The second provides a way of declaring services with multiple endpoints for those that don’t like the “ping-pong” concept in all cases; endpoints are tappable, lockable, and securable.

Install

npm install @ao-framework/portals

Global Reference Location

import Portals from "@ao-framework"

export default new Portals();

Event Bus

import portals from "./global.reference"

class AppState {
    public constructor() {
        portals.bus("app.state")
            .on("something", this.doSomething, this)
            .on("something.else", this.doSomething, null)
    }

    public doSomething() {}

    public unregister() {
        portals.bus("app.state")
            .removeListener("something", this.doSomething)
            .removeListener("something.else", this.doSomething)
    }
}

Service

class AppState {
    public constructor() {
        portals.service("app.state")
            .route("get.users", this.getUsers, this)//can be changed and tapped
            .routeTap("get.users", logger.debugSync, logger)
            .routeLock("get.users", this.getUsers, null)//cannot be changed
            .routeLockSec("get.users", this.getUsers, null)//cannot be tapped
    }
    //...
}

portals.services("app.state")
    .request("get.users", ...args)
    .then(users => console.log(users))

FAQs

Package last updated on 23 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.