3.1.78 • Published 5 days ago

timing-object v3.1.78

Weekly downloads
535
License
MIT
Repository
github
Last release
5 days ago

timing-object

An implementation of the timing object specification.

version

This is a standalone implementation of the TimingObject. It comes with an extensive set of tests. It is written in TypeScript and exposes its types but that's completely optional.

Installation

This package is available on npm. Run the following command to install it:

npm install timing-object

TimingObject class

The TimingObject class can be accessed like this.

import { TimingObject } from 'timing-object';

The TimingObject implements the spec with one notable difference as mentioned below.

timeupdate event

The timeupdate event is not implemented.

According to the spec it should emit "periodically with a fixed frequency of 5Hz". Unfortunately there is no way to emit an event in the browser with a constant frequency. Even if it would be possible it would probably only work for very few use cases. For the most part it will either emit too often or not often enough.

Let's say the timeupdate should be used to update the user interface. Modern browsers refresh the screen about 60 times per second. Thus an event that emits only 5 times a second will not emit often enough to update the screen every frame. The better alternative is to use requestAnimationFrame(). It can be used to schedule a function which runs once per animation frame (at approximately 60Hz).

import { TimingObject } from 'timing-object';

const timingObject = new TimingObject();

requestAnimationFrame(function updateUI() {
    const vector = timingObject.query();

    // ... do something with the vector ...

    requestAnimationFrame(updateUI);
});

ITimingProvider interface

Additionally the exported ITimingProvider interface can be used to implement a compatible TimingProvider.

import { ITimingProvider, TimingObject } from 'timing-object';

class MyCrazyTimingProvider implements ITimingProvider {
    // ... your implementation ...
}

One example of such a TimingProvider is the timing-provider package. It uses WebRTC as the underlying communication channel.

3.1.78

5 days ago

3.1.77

12 days ago

3.1.76

1 month ago

3.1.75

1 month ago

3.1.74

2 months ago

3.1.73

2 months ago

3.1.72

3 months ago

3.1.71

4 months ago

3.1.70

5 months ago

3.1.69

5 months ago

3.1.68

6 months ago

3.1.67

7 months ago

3.1.58

12 months ago

3.1.57

12 months ago

3.1.59

11 months ago

3.1.66

7 months ago

3.1.61

11 months ago

3.1.60

11 months ago

3.1.63

10 months ago

3.1.62

10 months ago

3.1.65

8 months ago

3.1.64

10 months ago

3.1.56

1 year ago

3.1.55

1 year ago

3.1.54

1 year ago

3.1.53

1 year ago

3.1.50

2 years ago

3.1.52

1 year ago

3.1.51

1 year ago

3.1.49

2 years ago

3.1.48

2 years ago

3.1.45

2 years ago

3.1.47

2 years ago

3.1.46

2 years ago

3.1.44

2 years ago

3.1.41

2 years ago

3.1.40

2 years ago

3.1.43

2 years ago

3.1.42

2 years ago

3.1.39

3 years ago

3.1.38

3 years ago

3.1.37

3 years ago

3.1.36

3 years ago

3.1.35

3 years ago

3.1.34

3 years ago

3.1.33

3 years ago

3.1.32

3 years ago

3.1.31

3 years ago

3.1.30

3 years ago

3.1.29

3 years ago

3.1.28

3 years ago

3.1.25

3 years ago

3.1.24

3 years ago

3.1.27

3 years ago

3.1.26

3 years ago

3.1.23

3 years ago

3.1.22

3 years ago

3.1.21

3 years ago

3.1.20

3 years ago

3.1.19

3 years ago

3.1.18

4 years ago

3.1.17

4 years ago

3.1.16

4 years ago

3.1.15

4 years ago

3.1.14

4 years ago

3.1.13

4 years ago

3.1.12

4 years ago

3.1.11

4 years ago

3.1.10

4 years ago

3.1.9

4 years ago

3.1.8

4 years ago

3.1.7

4 years ago

3.1.6

4 years ago

3.1.5

4 years ago

3.1.4

4 years ago

3.1.3

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.2.4

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.18

4 years ago

2.1.17

4 years ago

2.1.16

4 years ago

2.1.15

4 years ago

2.1.14

5 years ago

2.1.13

5 years ago

2.1.12

5 years ago

2.1.11

5 years ago

2.1.10

5 years ago

2.1.9

5 years ago

2.1.8

5 years ago

2.1.7

5 years ago

2.1.6

5 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.13

5 years ago

2.0.12

5 years ago

2.0.11

5 years ago

2.0.10

5 years ago

2.0.9

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago