Socket
Socket
Sign inDemoInstall

@bemobile/fusionbuilder

Package Overview
Dependencies
3
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @bemobile/fusionbuilder

BE-Mobile


Version published
Maintainers
3
Created

Readme

Source

BE-Mobile FusionBuilderJS

Javascript Utility library to conveniently build output for BE-Mobile Fusion.

Installation

Add the package to the project

npm install @bemobile/fusionbuilder

Usage

We recommend using the node-server, which provides a ready-to-use framework for building a NodeJS fusion server. But the fusion builder can be used without it:

Standalone

You can create a valid JSON and output it whichever way you like:

import { FusionBuilder, SoundType } from '@bemobile/fusionbuilder';

const fusion = new FusionBuilder();

const page = fusion.addPage('Homepage').setTitle('Homepage');

page.addHeader('Home').placeElement();
page.addButon('OK')
    .onClick()
    .messageDialog('You clicked OK')
    .onComplete()
    .playSound(SoundType.ERROR);

Express

import * as express from 'express';
import * as bodyParser from 'body-parser';
import { Input, SoundType, FusionBuilder } from '@bemobile/fusionbuilder';

type FusionRequest = express.Request & { fusion: FusionBuilder };

const app = express();
app.use(bodyParser.json());
app.use((req: FusionRequest) => {
    req.fusion = new FusionBuilder(new Input(req.body));
});

app.post('/', (req: FusionRequest, res) => {
    req.fusion.setGlobalParameter('test', 'foobar');

    const page = req.fusion.addPage('Homepage').setTitle('Homepage');

    page.addHeader('Home').placeElement();
    page.addButon('OK')
        .onClick()
        .messageDialog('You clicked OK')
        .onComplete()
        .playSound(SoundType.ERROR);

    res.json(req.fusion.getJsonState());
});

app.post('/post2', (req: FusionRequest, res) => {
    const page = req.fusion.addPage('Homepage').setTitle('Homepage');

    page.addHeader('Home').placeElement();
    page.addButon('OK')
        .onClick()
        .messageDialog('You clicked OK')
        .onComplete()
        .playSound(SoundType.ERROR);

    res.json(req.fusion.getJsonState());
});

FAQs

Last updated on 29 Apr 2022

Did you know?

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

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc