Skip to content
Jan Pánek edited this page Jul 19, 2021 · 3 revisions

Services are singletons that can be accesed by any Angular component. If you've never worked with services, I recommend to take a look in Angular's services documentation.

There are few different services in Systemizer, this section will not cover all services, but only those with useful methods that are more commonly used. Some methods are used for functions that are already implemented (placing items, selecting items etc.) those will not be shown.

Placing service

/app/placing.service.ts

Placing service is the service that takes care of creating and moving components. Most of the properties and methods are used for things like creating components, dragging and placing them and copy/pasting them, these functions are already implemented and will not be covered.

Method Arguments Description
showSnack message: string Shows a snackbar with a given message
connectPorts

portComponent1: PortComponent
portComponent2: PortComponent

Connecects two Angular port components
createComponent

component: Type
left: Number
top: Number
options: Options

Creates an Angular component with given options and position

These were some of the more commonly used methods from Placing service.

Saving service

/app/viewing.service.ts

Saving service takes care of saving to localStorage and getting a JSON representation of the board.

Method Arguments Description
getBoardJson

allLogicComponents: IDataOperator[]
systemName: string

Returns JSON with state of given array of components and name
save allLogicComponents: IDataOperator[] Saves the array of components to localStorage with the current system name

Export service

/app/viewing.service.ts

Viewing service is used to modify the look of the application. It can also change if certain elements are displayed or not.

Method Arguments Description
getComponentSize component: IDataOperator Returns {width: number, height: number} with size of the component

That is it for services. There are some services that weren't covered, those are either still in making or are not important for common use.