https://github.com/neutroniumcore/neutronium-vm-loader
Utility to load neutronium ViewModel from cjson file
https://github.com/neutroniumcore/neutronium-vm-loader
json neutronium
Last synced: about 2 months ago
JSON representation
Utility to load neutronium ViewModel from cjson file
- Host: GitHub
- URL: https://github.com/neutroniumcore/neutronium-vm-loader
- Owner: NeutroniumCore
- License: mit
- Created: 2017-12-19T01:44:01.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-01T12:32:13.000Z (over 3 years ago)
- Last Synced: 2025-03-04T07:40:18.746Z (over 1 year ago)
- Topics: json, neutronium
- Language: JavaScript
- Size: 331 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Neutronium vm loader
[](https://circleci.com/gh/NeutroniumCore/neutronium-vm-loader)
[](https://www.npmjs.com/package/neutronium-vm-loader)
[](https://github.com/NeutroniumCore/neutronium-vm-loader/blob/master/LICENSE)
Utility to parse [Neutronium](https://github.com/David-Desmaisons/Neutronium) generated `cjson` into javascript object. Used by [neutronium-vue](https://github.com/NeutroniumCore/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:
```javascript
import rawVm from '../data/vm'
import { createVM } from 'neutronium-vm-loader'
const vm = createVM(rawVm);
```
## Listen to command and return a value (for ResultCommand):
```javascript
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
```