1.4.6 • Published 9 months ago

confbridge v1.4.6

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

CONFBridge

CONFBridge is an communication libary between an CONFApp and CONFStation. It also provides debugging utils for develop an CONFApp.

Usage

Create CONFApp from template

npx confbridge create-app <app-name>

And follow the instructions.

Run conf app dev Server

npx confbridge dev

Install as package in your browser application

NPM

npm i confbridge

yarn

yarn add confbridge

Embedding

as JS Module from compiled lib

<script type="module">
    import {CONFStation, CONFApp} from "confbridge.js"; 
</script>

TypeScript

import { CONFStation, CONFApp } from "confbridge";

CONFStation

Schnittstelle für CONFApp zur CONFStation.

MethodeBeschreibung
.onReady( action:function )wird ausgeführt, wenn eine erfolgreiche Verbindung aufgebaut wurde.
.levelUp( meta:any, score:number, user:object )triggert ein LevelUp für den Spieler
.appFinished( meta:any, score: number, user:object)meldet, dass die CONFApp beendet werden soll
.onLanguageChange( action:function )wird ausgeführt, wenn die Sprache in der CONFStation geändert wird. Beim Ausführen dieser Funktion wird erwartet, dass eine CONFApp zur entsprechenden Sprache wechselt.
static .connected( action:function )Komfortfunktion, welche das Initialisieren der CONFStation-Instanz übernimmt und onReady ausführt
Komfort-Beispiel
<button id="level-up">Level UP!</button>
<script type="module">
    import {CONFStation} from "conf-bridge.js";
    CONFStation.connected((station, config, language, theme, profile) => {
        document.getElementById('level-up')
                .addEventListener('click', _ => station.levelUp())
    })
</script>
Example
<button id="level-up">Level UP!</button>
<script type="module">
    import {CONFStation} from "conf-bridge.js";
    const confStation = new CONFStation();
    confStation.onReady((config, language, theme, profile) => {
        document.getElementById('level-up')
                .addEventListener('click', _ => confStation.levelUp())
    })
</script>

CONFApp

Schnittstelle der CONFStation zur CONFApp.

MethodeBeschreibung
.onLevelUp( action:function )wird ausgeführt, wenn von der CONFApp ".levelUp" ausgeführt wird
.onAppFinished( action:function )wird ausgeführt, wenn von der CONFApp ".appFinished" ausgeführt wird
.setLanguage( language:string )ändert die Sprache einer CONFApp
Example
<iframe id="conf-app" src="whereever.nowhere.uni"></iframe>
<script type="module">
    import {CONFApp} from "conf-bridge.js";
    const config = {
        "options": []
    }
    const theme = {
        "borderColor": "#990000"
    }
    const profile = {
        firstName: 'Username',
        lastName: 'Hui',
        email: 'username@hui.lol'
    }
    const confApp = new CONFApp(config, document.getElementById('conf-app'), 'de', theme, profile)
    confApp.onLevelUp((meta, score, user) => {
        console.log({ meta, score, user })
    })
</script>

FAQ

veraltete Version mit npx

Benutze das "@latest" Tag, damit npx die aktuellste Version nutzt.

npx confbridge@latest dev
1.4.6

9 months ago

1.4.5

9 months ago

1.4.4

9 months ago

1.4.3

9 months ago

1.4.2

9 months ago

1.4.1

9 months ago

1.4.0

9 months ago

1.2.0

1 year ago

1.3.7

1 year ago

1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.3.10

1 year ago

1.3.13

1 year ago

1.3.14

1 year ago

1.3.11

1 year ago

1.3.12

1 year ago

1.3.17

1 year ago

1.3.15

1 year ago

1.3.16

1 year ago

1.3.9

1 year ago

1.3.8

1 year ago

1.1.13

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

1.0.0

2 years ago