Skip to content

NeutroniumCore/neutronium-vm-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neutronium vm loader

Build status Npm version MIT License

Utility to parse Neutronium generated cjson into javascript object. Used by neutronium-vue.

Vm loader is intendent to load data in design mode when using Neutronium. It is helpful when you design your solution decontected from C# back-end.

Typical use:

import rawVm from '../data/vm'
import { createVM } from 'neutronium-vm-loader'

const vm = createVM(rawVm);

Listen to command and return a value (for ResultCommand):

import { Command } from 'neutronium-vm-loader'

function commandListener(commandId, ...commandArguments) {
  if (commandId === 12) {
    return new Promise( //..
    );
  }
}

Command.listen(commandListener);

Command listen function is called with the command is as a first paremeter and the arguments which with the command has been called. listen return will be used by as the command result. The command id is set incrementally for each command of a view model.

Installation

npm install --save neutronium-vm-loader