0.3.0 • Published 5 months ago

immutable-core-service v0.3.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 months ago

immutable-core-service

Immutable Core Service integrates with the Immutable App ecosystem to provide persistent global services backed by shared immutable data state that can be reinitialized on a periodic basis.

Immutable Core Service is designed to support use cases like app configuration and access control that use data from Immutable Core Models but that data does not change from one request to the next.

Immutable Core Service requires native async/await support.

Creating a new service

var fooService = new ImmutableCoreService({
    name: 'foo',
    methods: {
        foo: function (args) { ... },
    },
    initialize: function (args) { .. },
    reinitializeInterval: 10,
})

In this example a service named foo is defined with a single foo method.

This will create an Immutable Core module with the module name fooService and two methods: foo and initialize.

The initialize method is called once when the service is first created and is then called at an interval defined by reinitializeInterval which is in seconds.

The data object returned by initialize will become the shared state for the service.

Data is stored in the module data and can be accessed via fooService.module.data.

Initializing services

await ImmutableCoreService.initializeAll()

The initializeAll method will call the initialize method for each globally registered service and resolve once all services have been initialized.

After all services have been initialized the global reinitialize check will be started.

Starting reinitialize check

ImmutableCoreService.reinitializeStart()

reinitializeStart sets an interval that will call reinitializeCheck every 1 second (1000ms).

This is called by initializeAll once it completes.

Stopping reinitialize check

ImmutableCoreService.reinitializeStop()

reinitializeStop clears the interval set by reinitializeStart. It does not abort any initialize calls in progress.

0.3.0

5 months ago

0.2.41

5 years ago

0.2.40

5 years ago

0.2.39

6 years ago

0.2.38

6 years ago

0.2.37

6 years ago

0.2.36

6 years ago

0.2.35

6 years ago

0.2.34

6 years ago

0.2.33

6 years ago

0.2.32

6 years ago

0.2.31

6 years ago

0.2.30

6 years ago

0.2.29

6 years ago

0.2.28

6 years ago

0.2.27

6 years ago

0.2.26

6 years ago

0.2.25

7 years ago

0.2.24

7 years ago

0.2.23

7 years ago

0.2.22

7 years ago

0.2.21

7 years ago

0.2.20

7 years ago

0.2.19

7 years ago

0.2.18

7 years ago

0.2.17

7 years ago

0.2.16

7 years ago

0.2.15

7 years ago

0.2.14

7 years ago

0.2.13

7 years ago

0.2.12

7 years ago

0.2.11

7 years ago

0.2.10

7 years ago

0.2.9

7 years ago

0.2.8

7 years ago

0.2.7

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago