System Runtime

System Runtime

  • Languages iconENGLISH
    • Română
    • Help Translate
  • SUPPORT
  • GITHUB

›Examples

Introduction

  • What is System Runtime ?
  • System Runtime architecture
  • What is Design First ?
  • Overview

Guides

  • Quick Start
  • How to install System Runtime
  • Design your model
  • Create components
  • Manage your components
  • Bundle your system
  • Extend System Runtime
  • Go deeper

Examples

  • A basic "hello world"
  • Create a bundle
  • Install a bundle client-side
  • Install a bundle in HTML
  • Install a bundle server-side
  • Package a bundle
  • Create a component
  • Create new types
  • Create a one to one relationship
  • Create a one to many relationship
  • Navigate through the model
  • Inheritance between components
  • Listen to a change of state of a component
  • Use System Runtime NoSQL Database
  • Object-Document Mapper in action
  • Use System Runtime core apis
  • Use System Runtime history apis
  • Quick Start example

APIS

  • Component Class
  • runtime Component
  • metamodel Component
  • logger Component
  • db Component
  • history Component
  • Document Collection

About

  • Who is behind System Runtime ?
  • License

Create new types

To create a new type you need to call the type method of metamodel component:

// create the system
const system = runtime.system('example08');

// create the model
const metamodel = runtime.require('metamodel');

// new adress type
metamodel.type('address', {
  'planet': 'string'
});

// new sex type
metamodel.type('sex', ['male', 'female']);

metamodel.schema('Jedi', {
  'firstName': 'property',
  'lastName': 'property',
  'sex': 'property',
  'address': 'property'
});

// override the model generated by the schema
metamodel.model('Jedi', {
  'sex': 'sex',
  'address': 'address'
});

metamodel.create();

const Jedi = runtime.require('Jedi');

new Jedi({
  '_id': 'yoda',
  'sex': 'male',
  'firstName': 'Yoda',
  'lastName': 'Master',
  'address': {
    'planet': 'Dagobah'
  }
});

system.on('start', () => {
  // get the component
  const yoda = this.require('yoda');

  // show Yoda's planet
  console.log(yoda.address().planet());
});

// run the system
system.start();

Version compatibility

Remember that the example works both on server and browser.

← Create a componentCreate a one to one relationship →
System Runtime is distributed under Apache License 2.0 - Copyright © 2024 Erwan Carriou