Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nodefony/nodefony-client

Client Side Nodefony Framework
https://github.com/nodefony/nodefony-client

cdn container event-management library-chunks mediastream nodefony nodefony-client sdp service sip syslog webaudio-api webpack webrtc

Last synced: 28 days ago
JSON representation

Client Side Nodefony Framework

Awesome Lists containing this project

README

        





NODEFONY CLIENT

![nodefony-client CI](https://github.com/nodefony/nodefony-client/workflows/nodefony-client%20CI/badge.svg?branch=main)

# Library Install
```bash
$ npm install nodefony-client
#or
$ yarn add nodefony-client
```

# Webpack Analyzer



```js

console.log(nodefony)
{
version: "6.0.0-beta.4",
environment: "development",
isRegExp: ƒ,
isObject: ƒ,
isFunction: ƒ,
Api: ƒ Api()
Container: ƒ Container(services, parameters)
Error: ƒ nodefonyError(message, code)
Events: ƒ Notification(settings, context)
ExtendedScope: ƒ ExtendedScope(name, parent)
PDU: ƒ PDU(pci, severity, moduleName, msgid, msg, date)
Scope: ƒ Scope(name, parent)
Service: ƒ Service(name, container, notificationsCenter)
Socket: ƒ Socket(url)
Storage: ƒ Storage(name)
Syslog: ƒ Syslog(settings)
URL: {parse: ƒ, resolve: ƒ, resolveObject: ƒ, format: ƒ, Url: ƒ}
WebSocket: ƒ Websocket(url)
browser: {flag: "chrome", name: "Chrome", version: "86.0.4240.80"}
environment: "development"
inspect: ƒ inspect(obj, opts)
isArray: ƒ isArray(ar)
isFunction: ƒ isFunction(arg)
isNullOrUndefined: ƒ isNullOrUndefined(arg)
isObject: ƒ isObject(arg)
isRegExp: ƒ isRegExp(re)
isUndefined: ƒ isUndefined(arg)
medias: Medias {MediaStream: ƒ}
nativeWebSocket: true
protocols: {Bayeux: ƒ}
util: {types: {…}, format: ƒ, deprecate: ƒ, debuglog: ƒ, inspect: ƒ, …}
version: "6.0.0-beta.4"
webAudio: {audioContext: ƒ, Mixer: ƒ, AudioBus: ƒ, Track: ƒ}
}
```

# Use With CDN
## cdn.jsdelivr.net

### latest base library
```html

```
### latest library + chunks
```html

```
### version library + chunks
```html

```

## unpkg.com

### latest base library
```html

```
### latest library + chunks
```html

```
### version library + chunks
```html

```

### CDN Available Library Chunks query : ?medias&sip
```
medias
socket
webaudio
sip
```
### CDN Available Library environment query : ?debug=true&environment=development
```
debug = sip,socket,webaudio,medias | true | flase
environment = production | development
```

# Use Nodefony-client In Webpack
## Release
```js
// import base library
import nodefony from "nodefony-client";
// import chunk medias
import media from "nodefony-client/src/medias/medias";
media(nodefony);
// import chunk webaudio
import webaudio from "nodefony-client/src/webaudio/webaudio";
webaudio(nodefony);
// import chunk socket
import socket from "nodefony-client/src/transports/socket/socket";
socket(nodefony);
```

## CommonJS modules
```js
const nodefony = require('nodefony-client')
//chunk
const socket = require("nodefony-client/src/transports/socket/socket");
socket.default(nodefony);
```

# Base Library
## Events
```js
const notificationsCenter = new nodefony.Events();

notificationsCenter.on("myEvent", (count, args) => {
console.log(count, args)
});

const obj = {foo:"bar"};
let i = 0;
notificationsCenter.emit("myEvent", i, obj);
notificationsCenter.emit("myEvent", ++i, obj);

// 0 {foo: "bar"}
// 1 {foo: "bar"}
```

## Service
```js
// nodefony.Service => (name, container = null, events = null, settings = {})

class myService extends nodefony.Service {
constructor(){
super("myService");
}
}
const instance = new myService();

console.log(instance)
{
container: Container {scope: {…}, services: C…r.protoService, parameters: C…r.protoParameters, protoService: ƒ, protoParameters: ƒ}
name: "myService"
notificationsCenter: Events {_events: {…}, _eventsCount: 1, _maxListeners: 20}
options: {}
settingsSyslog: {moduleName: "myService", defaultSeverity: "INFO"}
syslog: Syslog {_events: {…}, _eventsCount: 0, _maxListeners: undefined, settings: {…}, ringStack: Array(0), …}
}
```

## Syslog
```js
const syslog = new nodefony.Syslog();
syslog.init();
syslog.log('info', "INFO");
syslog.log('debug', "DEBUG");
syslog.log('notice', "NOTICE");
syslog.log('warning', "WARNING");
syslog.log('error', "ERROR");
syslog.log('alert', "ALERT");
syslog.log('critic', "CRITIC");
syslog.log('emergency', "EMERGENCY");

```