Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@universal-packages/dynamic-api

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@universal-packages/dynamic-api - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

4

DynamicApi.d.ts

@@ -0,3 +1,5 @@

/// <reference types="node" />
import { EventEmitter } from 'stream';
import { DynamicApiOptions, Dynamics } from './DynamicApi.types';
export default class DynamicApi<D extends Record<string, any>> {
export default class DynamicApi<D extends Record<string, any>> extends EventEmitter {
readonly options: DynamicApiOptions;

@@ -4,0 +6,0 @@ readonly dynamics: Dynamics;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const module_loader_1 = require("@universal-packages/module-loader");
class DynamicApi {
const stream_1 = require("stream");
class DynamicApi extends stream_1.EventEmitter {
constructor(options) {
super();
this.dynamics = {};

@@ -7,0 +9,0 @@ this.options = { ...options };

{
"name": "@universal-packages/dynamic-api",
"version": "1.2.0",
"version": "1.3.0",
"description": "Dynamic decoupling-adapting system",

@@ -5,0 +5,0 @@ "author": "David De Anda <david@universal-packages.com> (https://github.com/universal-packages)",

@@ -164,2 +164,22 @@ # Dynamic API

## Even Emitter
DynamicApi is an emitter, it does not emit anything by itself but you can use it to communicate to other parts of your app what is going on in your dynamics.
```js
import { Dynamic } from '@universal-packages/dynamic-api'
@Dynamic('calculate')
export default class CalculateDynamic {
public async perform(payload, dynamicApi) {
dynamicApi.emit('event', 'A calculation was done')
if(payload.fast) {
return 'I did it fast'
} else {
return 'I was slow'
}
}
}
```
## Typescript

@@ -166,0 +186,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc