Home Manual Reference Source Repository
import Service from 'netflux/src/service/Service.js'
public class | source

Service

Abstract class which each service should inherit. Each service is independent and can store data temporarly in order to accomplish its task(s).

Constructor Summary

Public Constructor
public

It should be invoked only by calling super from the children constructor.

Member Summary

Public Members
public

The service unique identifier.

Method Summary

Public Methods
public

getItem(obj: Object, id: number): Object

Get item identified by obj and id.

public

Get all items belonging to obj.

public

Get pending request identified by obj and id.

public

removeItem(obj: Object, id: number)

Remove item identified by obj and id.

public

setItem(obj: Object, id: number, data: Object)

Add item with obj and ìd as identifier.

public

setPendingRequest(obj: Object, id: number, data: {resolve: Promise.resolve, reject: Promise.reject}, timeout: number)

Add a new pending request identified by obj and id.

Public Constructors

public constructor(id: number) source

It should be invoked only by calling super from the children constructor.

Params:

NameTypeAttributeDescription
id number

The service unique identifier

Public Members

public id: number source

The service unique identifier.

Public Methods

public getItem(obj: Object, id: number): Object source

Get item identified by obj and id.

Params:

NameTypeAttributeDescription
obj Object
id number

Return:

Object

public getItems(obj: Object): Map source

Get all items belonging to obj.

Params:

NameTypeAttributeDescription
obj Object

Return:

Map

public getPendingRequest(obj: Object, id: number): {resolve: Promise.resolve, reject: Promise.reject} source

Get pending request identified by obj and id.

Params:

NameTypeAttributeDescription
obj Object
id number

Return:

{resolve: Promise.resolve, reject: Promise.reject}

public removeItem(obj: Object, id: number) source

Remove item identified by obj and id.

Params:

NameTypeAttributeDescription
obj Object
id number

public setItem(obj: Object, id: number, data: Object) source

Add item with obj and ìd as identifier.

Params:

NameTypeAttributeDescription
obj Object
id number
data Object

public setPendingRequest(obj: Object, id: number, data: {resolve: Promise.resolve, reject: Promise.reject}, timeout: number) source

Add a new pending request identified by obj and id.

Params:

NameTypeAttributeDescription
obj Object
id number
data {resolve: Promise.resolve, reject: Promise.reject}
timeout number
  • optional
  • default: DEFAULT_REQUEST_TIMEOUT

Timeout in milliseconds