@fluidframework/counter 2.0.0-internal.1.0.0.82693 → 2.0.0-internal.1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mocharc.js +12 -0
- package/api-extractor.json +1 -1
- package/dist/counter.d.ts +33 -18
- package/dist/counter.d.ts.map +1 -1
- package/dist/counter.js +34 -19
- package/dist/counter.js.map +1 -1
- package/dist/counterFactory.d.ts +18 -1
- package/dist/counterFactory.d.ts.map +1 -1
- package/dist/counterFactory.js +18 -1
- package/dist/counterFactory.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +9 -4
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/counter.d.ts +33 -18
- package/lib/counter.d.ts.map +1 -1
- package/lib/counter.js +34 -19
- package/lib/counter.js.map +1 -1
- package/lib/counterFactory.d.ts +18 -1
- package/lib/counterFactory.d.ts.map +1 -1
- package/lib/counterFactory.js +18 -1
- package/lib/counterFactory.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/interfaces.d.ts +9 -4
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +12 -12
- package/src/counter.ts +45 -28
- package/src/counterFactory.ts +20 -3
- package/src/index.ts +2 -2
- package/src/interfaces.ts +9 -4
- package/src/packageVersion.ts +1 -1
package/.mocharc.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const getFluidTestMochaConfig = require('@fluidframework/mocha-test-setup/mocharc-common');
|
|
9
|
+
|
|
10
|
+
const packageDir = __dirname;
|
|
11
|
+
const config = getFluidTestMochaConfig(packageDir);
|
|
12
|
+
module.exports = config;
|
package/api-extractor.json
CHANGED
package/dist/counter.d.ts
CHANGED
|
@@ -8,48 +8,58 @@ import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
|
|
|
8
8
|
import { IFluidSerializer, SharedObject } from "@fluidframework/shared-object-base";
|
|
9
9
|
import { ISharedCounter, ISharedCounterEvents } from "./interfaces";
|
|
10
10
|
/**
|
|
11
|
-
* A
|
|
12
|
-
*
|
|
11
|
+
* A shared object that holds a number that can be incremented or decremented.
|
|
12
|
+
*
|
|
13
|
+
* @remarks Note that `SharedCounter` only operates on integer values. This is validated at runtime.
|
|
13
14
|
*
|
|
14
|
-
* @
|
|
15
|
-
* ### Creation
|
|
15
|
+
* @example Creating a `SharedCounter`:
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* First, get the factory and call {@link @fluidframework/datastore-definitions#IChannelFactory.create}
|
|
18
|
+
* with a runtime and string ID:
|
|
18
19
|
*
|
|
19
20
|
* ```typescript
|
|
20
21
|
* const factory = SharedCounter.getFactory();
|
|
21
22
|
* const counter = factory.create(this.runtime, id) as SharedCounter;
|
|
22
23
|
* ```
|
|
23
24
|
*
|
|
24
|
-
*
|
|
25
|
+
* The initial value of a new `SharedCounter` is 0.
|
|
26
|
+
* If you wish to initialize the counter to a different value, you may call {@link SharedCounter.increment} before
|
|
27
|
+
* attaching the Container, or before inserting it into an existing shared object.
|
|
28
|
+
*
|
|
29
|
+
* @example Using the `SharedCounter`:
|
|
25
30
|
*
|
|
26
|
-
* Once created, you can call
|
|
31
|
+
* Once created, you can call {@link SharedCounter.increment} to modify the value with either a positive or
|
|
32
|
+
* negative number:
|
|
27
33
|
*
|
|
28
34
|
* ```typescript
|
|
29
35
|
* counter.increment(10); // add 10 to the counter value
|
|
30
36
|
* counter.increment(-5); // subtract 5 from the counter value
|
|
31
37
|
* ```
|
|
32
38
|
*
|
|
33
|
-
* To observe changes to the value (including those from remote clients), register for the
|
|
39
|
+
* To observe changes to the value (including those from remote clients), register for the
|
|
40
|
+
* {@link ISharedCounterEvents | incremented} event:
|
|
34
41
|
*
|
|
35
42
|
* ```typescript
|
|
36
43
|
* counter.on("incremented", (incrementAmount, newValue) => {
|
|
37
44
|
* console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);
|
|
38
45
|
* });
|
|
39
46
|
* ```
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
40
49
|
*/
|
|
41
50
|
export declare class SharedCounter extends SharedObject<ISharedCounterEvents> implements ISharedCounter {
|
|
42
51
|
/**
|
|
43
|
-
* Create a new
|
|
52
|
+
* Create a new {@link SharedCounter}.
|
|
53
|
+
*
|
|
54
|
+
* @param runtime - The data store runtime to which the new `SharedCounter` will belong.
|
|
55
|
+
* @param id - Optional name of the `SharedCounter`. If not provided, one will be generated.
|
|
44
56
|
*
|
|
45
|
-
* @param runtime - data store runtime the new shared counter belongs to
|
|
46
|
-
* @param id - optional name of the shared counter
|
|
47
57
|
* @returns newly create shared counter (but not attached yet)
|
|
48
58
|
*/
|
|
49
59
|
static create(runtime: IFluidDataStoreRuntime, id?: string): SharedCounter;
|
|
50
60
|
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
|
|
51
61
|
/**
|
|
52
|
-
* Get a factory for SharedCounter to register with the data store.
|
|
62
|
+
* Get a factory for {@link SharedCounter} to register with the data store.
|
|
53
63
|
*
|
|
54
64
|
* @returns a factory that creates and load SharedCounter
|
|
55
65
|
*/
|
|
@@ -65,34 +75,39 @@ export declare class SharedCounter extends SharedObject<ISharedCounterEvents> im
|
|
|
65
75
|
increment(incrementAmount: number): void;
|
|
66
76
|
private incrementCore;
|
|
67
77
|
/**
|
|
68
|
-
* Create a summary for the counter
|
|
78
|
+
* Create a summary for the counter.
|
|
79
|
+
*
|
|
80
|
+
* @returns The summary of the current state of the counter.
|
|
69
81
|
*
|
|
70
|
-
* @returns the summary of the current state of the counter
|
|
71
82
|
* @internal
|
|
72
83
|
*/
|
|
73
84
|
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
|
|
74
85
|
/**
|
|
75
86
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
87
|
+
*
|
|
76
88
|
* @internal
|
|
77
89
|
*/
|
|
78
90
|
protected loadCore(storage: IChannelStorageService): Promise<void>;
|
|
79
91
|
/**
|
|
80
92
|
* Called when the object has disconnected from the delta stream.
|
|
93
|
+
*
|
|
81
94
|
* @internal
|
|
82
95
|
*/
|
|
83
96
|
protected onDisconnect(): void;
|
|
84
97
|
/**
|
|
85
|
-
* Process a counter operation
|
|
98
|
+
* Process a counter operation (op).
|
|
86
99
|
*
|
|
87
|
-
* @param message -
|
|
88
|
-
* @param local -
|
|
100
|
+
* @param message - The message to prepare.
|
|
101
|
+
* @param local - Whether or not the message was sent by the local client.
|
|
89
102
|
* @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
|
|
90
|
-
* For messages from a remote client, this will be undefined
|
|
103
|
+
* For messages from a remote client, this will be `undefined`.
|
|
104
|
+
*
|
|
91
105
|
* @internal
|
|
92
106
|
*/
|
|
93
107
|
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
94
108
|
/**
|
|
95
109
|
* Not implemented.
|
|
110
|
+
*
|
|
96
111
|
* @internal
|
|
97
112
|
*/
|
|
98
113
|
protected applyStashedOp(): void;
|
package/dist/counter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"counter.d.ts","sourceRoot":"","sources":["../src/counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EACH,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EACrB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAA2B,gBAAgB,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAE7G,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"counter.d.ts","sourceRoot":"","sources":["../src/counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EACH,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EACrB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAA2B,gBAAgB,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAE7G,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAsBpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,aAAc,SAAQ,YAAY,CAAC,oBAAoB,CAAE,YAAW,cAAc;IAC3F;;;;;;;OAOG;WACW,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,aAAa;gBAIrE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,kBAAkB;IAIvF;;;;OAIG;WACW,UAAU,IAAI,eAAe;IAI3C,OAAO,CAAC,MAAM,CAAa;IAE3B;;OAEG;IACH,IAAW,KAAK,IAAI,MAAM,CAEzB;IAED;;OAEG;IACI,SAAS,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI;IAgB/C,OAAO,CAAC,aAAa;IAKrB;;;;;;OAMG;IACH,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;IAU5E;;;;OAIG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxE;;;;OAIG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;IAE9B;;;;;;;;;OASG;IACH,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAezG;;;;OAIG;IACH,SAAS,CAAC,cAAc;CAG3B"}
|
package/dist/counter.js
CHANGED
|
@@ -11,35 +11,44 @@ const shared_object_base_1 = require("@fluidframework/shared-object-base");
|
|
|
11
11
|
const counterFactory_1 = require("./counterFactory");
|
|
12
12
|
const snapshotFileName = "header";
|
|
13
13
|
/**
|
|
14
|
-
* A
|
|
15
|
-
*
|
|
14
|
+
* A shared object that holds a number that can be incremented or decremented.
|
|
15
|
+
*
|
|
16
|
+
* @remarks Note that `SharedCounter` only operates on integer values. This is validated at runtime.
|
|
16
17
|
*
|
|
17
|
-
* @
|
|
18
|
-
* ### Creation
|
|
18
|
+
* @example Creating a `SharedCounter`:
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* First, get the factory and call {@link @fluidframework/datastore-definitions#IChannelFactory.create}
|
|
21
|
+
* with a runtime and string ID:
|
|
21
22
|
*
|
|
22
23
|
* ```typescript
|
|
23
24
|
* const factory = SharedCounter.getFactory();
|
|
24
25
|
* const counter = factory.create(this.runtime, id) as SharedCounter;
|
|
25
26
|
* ```
|
|
26
27
|
*
|
|
27
|
-
*
|
|
28
|
+
* The initial value of a new `SharedCounter` is 0.
|
|
29
|
+
* If you wish to initialize the counter to a different value, you may call {@link SharedCounter.increment} before
|
|
30
|
+
* attaching the Container, or before inserting it into an existing shared object.
|
|
31
|
+
*
|
|
32
|
+
* @example Using the `SharedCounter`:
|
|
28
33
|
*
|
|
29
|
-
* Once created, you can call
|
|
34
|
+
* Once created, you can call {@link SharedCounter.increment} to modify the value with either a positive or
|
|
35
|
+
* negative number:
|
|
30
36
|
*
|
|
31
37
|
* ```typescript
|
|
32
38
|
* counter.increment(10); // add 10 to the counter value
|
|
33
39
|
* counter.increment(-5); // subtract 5 from the counter value
|
|
34
40
|
* ```
|
|
35
41
|
*
|
|
36
|
-
* To observe changes to the value (including those from remote clients), register for the
|
|
42
|
+
* To observe changes to the value (including those from remote clients), register for the
|
|
43
|
+
* {@link ISharedCounterEvents | incremented} event:
|
|
37
44
|
*
|
|
38
45
|
* ```typescript
|
|
39
46
|
* counter.on("incremented", (incrementAmount, newValue) => {
|
|
40
47
|
* console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);
|
|
41
48
|
* });
|
|
42
49
|
* ```
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
43
52
|
*/
|
|
44
53
|
class SharedCounter extends shared_object_base_1.SharedObject {
|
|
45
54
|
constructor(id, runtime, attributes) {
|
|
@@ -47,17 +56,18 @@ class SharedCounter extends shared_object_base_1.SharedObject {
|
|
|
47
56
|
this._value = 0;
|
|
48
57
|
}
|
|
49
58
|
/**
|
|
50
|
-
* Create a new
|
|
59
|
+
* Create a new {@link SharedCounter}.
|
|
60
|
+
*
|
|
61
|
+
* @param runtime - The data store runtime to which the new `SharedCounter` will belong.
|
|
62
|
+
* @param id - Optional name of the `SharedCounter`. If not provided, one will be generated.
|
|
51
63
|
*
|
|
52
|
-
* @param runtime - data store runtime the new shared counter belongs to
|
|
53
|
-
* @param id - optional name of the shared counter
|
|
54
64
|
* @returns newly create shared counter (but not attached yet)
|
|
55
65
|
*/
|
|
56
66
|
static create(runtime, id) {
|
|
57
67
|
return runtime.createChannel(id, counterFactory_1.CounterFactory.Type);
|
|
58
68
|
}
|
|
59
69
|
/**
|
|
60
|
-
* Get a factory for SharedCounter to register with the data store.
|
|
70
|
+
* Get a factory for {@link SharedCounter} to register with the data store.
|
|
61
71
|
*
|
|
62
72
|
* @returns a factory that creates and load SharedCounter
|
|
63
73
|
*/
|
|
@@ -91,9 +101,10 @@ class SharedCounter extends shared_object_base_1.SharedObject {
|
|
|
91
101
|
this.emit("incremented", incrementAmount, this._value);
|
|
92
102
|
}
|
|
93
103
|
/**
|
|
94
|
-
* Create a summary for the counter
|
|
104
|
+
* Create a summary for the counter.
|
|
105
|
+
*
|
|
106
|
+
* @returns The summary of the current state of the counter.
|
|
95
107
|
*
|
|
96
|
-
* @returns the summary of the current state of the counter
|
|
97
108
|
* @internal
|
|
98
109
|
*/
|
|
99
110
|
summarizeCore(serializer) {
|
|
@@ -106,6 +117,7 @@ class SharedCounter extends shared_object_base_1.SharedObject {
|
|
|
106
117
|
}
|
|
107
118
|
/**
|
|
108
119
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
120
|
+
*
|
|
109
121
|
* @internal
|
|
110
122
|
*/
|
|
111
123
|
async loadCore(storage) {
|
|
@@ -114,16 +126,18 @@ class SharedCounter extends shared_object_base_1.SharedObject {
|
|
|
114
126
|
}
|
|
115
127
|
/**
|
|
116
128
|
* Called when the object has disconnected from the delta stream.
|
|
129
|
+
*
|
|
117
130
|
* @internal
|
|
118
131
|
*/
|
|
119
132
|
onDisconnect() { }
|
|
120
133
|
/**
|
|
121
|
-
* Process a counter operation
|
|
134
|
+
* Process a counter operation (op).
|
|
122
135
|
*
|
|
123
|
-
* @param message -
|
|
124
|
-
* @param local -
|
|
136
|
+
* @param message - The message to prepare.
|
|
137
|
+
* @param local - Whether or not the message was sent by the local client.
|
|
125
138
|
* @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
|
|
126
|
-
* For messages from a remote client, this will be undefined
|
|
139
|
+
* For messages from a remote client, this will be `undefined`.
|
|
140
|
+
*
|
|
127
141
|
* @internal
|
|
128
142
|
*/
|
|
129
143
|
processCore(message, local, localOpMetadata) {
|
|
@@ -140,10 +154,11 @@ class SharedCounter extends shared_object_base_1.SharedObject {
|
|
|
140
154
|
}
|
|
141
155
|
/**
|
|
142
156
|
* Not implemented.
|
|
157
|
+
*
|
|
143
158
|
* @internal
|
|
144
159
|
*/
|
|
145
160
|
applyStashedOp() {
|
|
146
|
-
throw new Error("
|
|
161
|
+
throw new Error("Not implemented");
|
|
147
162
|
}
|
|
148
163
|
}
|
|
149
164
|
exports.SharedCounter = SharedCounter;
|
package/dist/counter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"counter.js","sourceRoot":"","sources":["../src/counter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+EAA8F;AAO9F,+DAA4D;AAE5D,2EAA6G;AAC7G,qDAAkD;
|
|
1
|
+
{"version":3,"file":"counter.js","sourceRoot":"","sources":["../src/counter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+EAA8F;AAO9F,+DAA4D;AAE5D,2EAA6G;AAC7G,qDAAkD;AAqBlD,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAa,aAAc,SAAQ,iCAAkC;IAajE,YAAY,EAAU,EAAE,OAA+B,EAAE,UAA8B;QACnF,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;QAY7C,WAAM,GAAW,CAAC,CAAC;IAX3B,CAAC;IAdD;;;;;;;OAOG;IACI,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW;QAC7D,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,+BAAc,CAAC,IAAI,CAAkB,CAAC;IAC3E,CAAC;IAMD;;;;OAIG;IACI,MAAM,CAAC,UAAU;QACpB,OAAO,IAAI,+BAAc,EAAE,CAAC;IAChC,CAAC;IAID;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,eAAuB;QACpC,uGAAuG;QACvG,wGAAwG;QACxG,IAAI,eAAe,GAAG,CAAC,KAAK,CAAC,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACvD;QAED,MAAM,EAAE,GAAwB;YAC5B,IAAI,EAAE,WAAW;YACjB,eAAe;SAClB,CAAC;QAEF,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QACpC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAEO,aAAa,CAAC,eAAuB;QACzC,IAAI,CAAC,MAAM,IAAI,eAAe,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;OAMG;IACO,aAAa,CAAC,UAA4B;QAChD,kCAAkC;QAClC,MAAM,OAAO,GAA2B;YACpC,KAAK,EAAE,IAAI,CAAC,KAAK;SACpB,CAAC;QAEF,wCAAwC;QACxC,OAAO,IAAA,4CAAuB,EAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,QAAQ,CAAC,OAA+B;QACpD,MAAM,OAAO,GAAG,MAAM,IAAA,2BAAY,EAAyB,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAEtF,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACO,YAAY,KAAW,CAAC;IAElC;;;;;;;;;OASG;IACO,WAAW,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QAC9F,IAAI,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE;YAClD,MAAM,EAAE,GAAG,OAAO,CAAC,QAA+B,CAAC;YAEnD,QAAQ,EAAE,CAAC,IAAI,EAAE;gBACb,KAAK,WAAW;oBACZ,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC;oBACvC,MAAM;gBAEV;oBACI,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;aAC5C;SACJ;IACL,CAAC;IAED;;;;OAIG;IACO,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ;AA/HD,sCA+HC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelFactory,\n IChannelAttributes,\n} from \"@fluidframework/datastore-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { createSingleBlobSummary, IFluidSerializer, SharedObject } from \"@fluidframework/shared-object-base\";\nimport { CounterFactory } from \"./counterFactory\";\nimport { ISharedCounter, ISharedCounterEvents } from \"./interfaces\";\n\n/**\n * Describes the operation (op) format for incrementing the {@link SharedCounter}.\n */\ninterface IIncrementOperation {\n type: \"increment\";\n incrementAmount: number;\n}\n\n/**\n * @remarks Used in snapshotting.\n */\ninterface ICounterSnapshotFormat {\n /**\n * The value of the counter.\n */\n value: number;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * A shared object that holds a number that can be incremented or decremented.\n *\n * @remarks Note that `SharedCounter` only operates on integer values. This is validated at runtime.\n *\n * @example Creating a `SharedCounter`:\n *\n * First, get the factory and call {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n * with a runtime and string ID:\n *\n * ```typescript\n * const factory = SharedCounter.getFactory();\n * const counter = factory.create(this.runtime, id) as SharedCounter;\n * ```\n *\n * The initial value of a new `SharedCounter` is 0.\n * If you wish to initialize the counter to a different value, you may call {@link SharedCounter.increment} before\n * attaching the Container, or before inserting it into an existing shared object.\n *\n * @example Using the `SharedCounter`:\n *\n * Once created, you can call {@link SharedCounter.increment} to modify the value with either a positive or\n * negative number:\n *\n * ```typescript\n * counter.increment(10); // add 10 to the counter value\n * counter.increment(-5); // subtract 5 from the counter value\n * ```\n *\n * To observe changes to the value (including those from remote clients), register for the\n * {@link ISharedCounterEvents | incremented} event:\n *\n * ```typescript\n * counter.on(\"incremented\", (incrementAmount, newValue) => {\n * console.log(`The counter incremented by ${incrementAmount} and now has a value of ${newValue}`);\n * });\n * ```\n *\n * @public\n */\nexport class SharedCounter extends SharedObject<ISharedCounterEvents> implements ISharedCounter {\n /**\n * Create a new {@link SharedCounter}.\n *\n * @param runtime - The data store runtime to which the new `SharedCounter` will belong.\n * @param id - Optional name of the `SharedCounter`. If not provided, one will be generated.\n *\n * @returns newly create shared counter (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string): SharedCounter {\n return runtime.createChannel(id, CounterFactory.Type) as SharedCounter;\n }\n\n constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes) {\n super(id, runtime, attributes, \"fluid_counter_\");\n }\n\n /**\n * Get a factory for {@link SharedCounter} to register with the data store.\n *\n * @returns a factory that creates and load SharedCounter\n */\n public static getFactory(): IChannelFactory {\n return new CounterFactory();\n }\n\n private _value: number = 0;\n\n /**\n * {@inheritDoc ISharedCounter.value}\n */\n public get value(): number {\n return this._value;\n }\n\n /**\n * {@inheritDoc ISharedCounter.increment}\n */\n public increment(incrementAmount: number): void {\n // Incrementing by floating point numbers will be eventually inconsistent, since the order in which the\n // increments are applied affects the result. A more-robust solution would be required to support this.\n if (incrementAmount % 1 !== 0) {\n throw new Error(\"Must increment by a whole number\");\n }\n\n const op: IIncrementOperation = {\n type: \"increment\",\n incrementAmount,\n };\n\n this.incrementCore(incrementAmount);\n this.submitLocalMessage(op);\n }\n\n private incrementCore(incrementAmount: number): void {\n this._value += incrementAmount;\n this.emit(\"incremented\", incrementAmount, this._value);\n }\n\n /**\n * Create a summary for the counter.\n *\n * @returns The summary of the current state of the counter.\n *\n * @internal\n */\n protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n // Get a serializable form of data\n const content: ICounterSnapshotFormat = {\n value: this.value,\n };\n\n // And then construct the summary for it\n return createSingleBlobSummary(snapshotFileName, JSON.stringify(content));\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n *\n * @internal\n */\n protected async loadCore(storage: IChannelStorageService): Promise<void> {\n const content = await readAndParse<ICounterSnapshotFormat>(storage, snapshotFileName);\n\n this._value = content.value;\n }\n\n /**\n * Called when the object has disconnected from the delta stream.\n *\n * @internal\n */\n protected onDisconnect(): void { }\n\n /**\n * Process a counter operation (op).\n *\n * @param message - The message to prepare.\n * @param local - Whether or not the message was sent by the local client.\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be `undefined`.\n *\n * @internal\n */\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n if (message.type === MessageType.Operation && !local) {\n const op = message.contents as IIncrementOperation;\n\n switch (op.type) {\n case \"increment\":\n this.incrementCore(op.incrementAmount);\n break;\n\n default:\n throw new Error(\"Unknown operation\");\n }\n }\n }\n\n /**\n * Not implemented.\n *\n * @internal\n */\n protected applyStashedOp() {\n throw new Error(\"Not implemented\");\n }\n}\n"]}
|
package/dist/counterFactory.d.ts
CHANGED
|
@@ -5,17 +5,34 @@
|
|
|
5
5
|
import { IChannelAttributes, IFluidDataStoreRuntime, IChannelServices, IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
6
6
|
import { ISharedCounter } from "./interfaces";
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedCounter}.
|
|
9
|
+
*
|
|
10
|
+
* @sealed
|
|
9
11
|
*/
|
|
10
12
|
export declare class CounterFactory implements IChannelFactory {
|
|
13
|
+
/**
|
|
14
|
+
* Static value for {@link CounterFactory."type"}.
|
|
15
|
+
*/
|
|
11
16
|
static readonly Type = "https://graph.microsoft.com/types/counter";
|
|
17
|
+
/**
|
|
18
|
+
* Static value for {@link CounterFactory.attributes}.
|
|
19
|
+
*/
|
|
12
20
|
static readonly Attributes: IChannelAttributes;
|
|
21
|
+
/**
|
|
22
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
|
|
23
|
+
*/
|
|
13
24
|
get type(): string;
|
|
25
|
+
/**
|
|
26
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}
|
|
27
|
+
*/
|
|
14
28
|
get attributes(): IChannelAttributes;
|
|
15
29
|
/**
|
|
16
30
|
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
|
|
17
31
|
*/
|
|
18
32
|
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<ISharedCounter>;
|
|
33
|
+
/**
|
|
34
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
|
|
35
|
+
*/
|
|
19
36
|
create(document: IFluidDataStoreRuntime, id: string): ISharedCounter;
|
|
20
37
|
}
|
|
21
38
|
//# sourceMappingURL=counterFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"counterFactory.d.ts","sourceRoot":"","sources":["../src/counterFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C
|
|
1
|
+
{"version":3,"file":"counterFactory.d.ts","sourceRoot":"","sources":["../src/counterFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C;;;;GAIG;AACH,qBAAa,cAAe,YAAW,eAAe;IAClD;;OAEG;IACH,gBAAuB,IAAI,+CAA+C;IAE1E;;OAEG;IACH,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED;;OAEG;IACU,IAAI,CACb,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IAM5D;;OAEG;IACI,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc;CAK9E"}
|
package/dist/counterFactory.js
CHANGED
|
@@ -8,12 +8,20 @@ exports.CounterFactory = void 0;
|
|
|
8
8
|
const counter_1 = require("./counter");
|
|
9
9
|
const packageVersion_1 = require("./packageVersion");
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedCounter}.
|
|
12
|
+
*
|
|
13
|
+
* @sealed
|
|
12
14
|
*/
|
|
13
15
|
class CounterFactory {
|
|
16
|
+
/**
|
|
17
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
|
|
18
|
+
*/
|
|
14
19
|
get type() {
|
|
15
20
|
return CounterFactory.Type;
|
|
16
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}
|
|
24
|
+
*/
|
|
17
25
|
get attributes() {
|
|
18
26
|
return CounterFactory.Attributes;
|
|
19
27
|
}
|
|
@@ -25,6 +33,9 @@ class CounterFactory {
|
|
|
25
33
|
await counter.load(services);
|
|
26
34
|
return counter;
|
|
27
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
|
|
38
|
+
*/
|
|
28
39
|
create(document, id) {
|
|
29
40
|
const counter = new counter_1.SharedCounter(id, document, this.attributes);
|
|
30
41
|
counter.initializeLocal();
|
|
@@ -32,7 +43,13 @@ class CounterFactory {
|
|
|
32
43
|
}
|
|
33
44
|
}
|
|
34
45
|
exports.CounterFactory = CounterFactory;
|
|
46
|
+
/**
|
|
47
|
+
* Static value for {@link CounterFactory."type"}.
|
|
48
|
+
*/
|
|
35
49
|
CounterFactory.Type = "https://graph.microsoft.com/types/counter";
|
|
50
|
+
/**
|
|
51
|
+
* Static value for {@link CounterFactory.attributes}.
|
|
52
|
+
*/
|
|
36
53
|
CounterFactory.Attributes = {
|
|
37
54
|
type: CounterFactory.Type,
|
|
38
55
|
snapshotFormatVersion: "0.1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"counterFactory.js","sourceRoot":"","sources":["../src/counterFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,uCAA0C;AAE1C,qDAA8C;AAE9C
|
|
1
|
+
{"version":3,"file":"counterFactory.js","sourceRoot":"","sources":["../src/counterFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,uCAA0C;AAE1C,qDAA8C;AAE9C;;;;GAIG;AACH,MAAa,cAAc;IAevB;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,cAAc,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,cAAc,CAAC,UAAU,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CACb,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAC9B,MAAM,OAAO,GAAG,IAAI,uBAAa,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAC3D,MAAM,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAgC,EAAE,EAAU;QACtD,MAAM,OAAO,GAAG,IAAI,uBAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACjE,OAAO,CAAC,eAAe,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IACnB,CAAC;;AAjDL,wCAkDC;AAjDG;;GAEG;AACoB,mBAAI,GAAG,2CAA2C,CAAC;AAE1E;;GAEG;AACoB,yBAAU,GAAuB;IACpD,IAAI,EAAE,cAAc,CAAC,IAAI;IACzB,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,2BAAU;CAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { SharedCounter } from \"./counter\";\nimport { ISharedCounter } from \"./interfaces\";\nimport { pkgVersion } from \"./packageVersion\";\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedCounter}.\n *\n * @sealed\n */\nexport class CounterFactory implements IChannelFactory {\n /**\n * Static value for {@link CounterFactory.\"type\"}.\n */\n public static readonly Type = \"https://graph.microsoft.com/types/counter\";\n\n /**\n * Static value for {@link CounterFactory.attributes}.\n */\n public static readonly Attributes: IChannelAttributes = {\n type: CounterFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n */\n public get type(): string {\n return CounterFactory.Type;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n */\n public get attributes(): IChannelAttributes {\n return CounterFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<ISharedCounter> {\n const counter = new SharedCounter(id, runtime, attributes);\n await counter.load(services);\n return counter;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n */\n public create(document: IFluidDataStoreRuntime, id: string): ISharedCounter {\n const counter = new SharedCounter(id, document, this.attributes);\n counter.initializeLocal();\n return counter;\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* This package contains the SharedCounter distributed data structure.
|
|
7
|
-
* which holds a number that can be incremented or decremented.
|
|
6
|
+
* This package contains the {@link SharedCounter} distributed data structure.
|
|
7
|
+
* A `SharedCounter` is a shared object which holds a whole number that can be incremented or decremented.
|
|
8
8
|
*
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
package/dist/index.js
CHANGED
|
@@ -15,8 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/**
|
|
18
|
-
* This package contains the SharedCounter distributed data structure.
|
|
19
|
-
* which holds a number that can be incremented or decremented.
|
|
18
|
+
* This package contains the {@link SharedCounter} distributed data structure.
|
|
19
|
+
* A `SharedCounter` is a shared object which holds a whole number that can be incremented or decremented.
|
|
20
20
|
*
|
|
21
21
|
* @packageDocumentation
|
|
22
22
|
*/
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH;;;;;GAKG;AAEH,4CAA0B;AAC1B,+CAA6B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This package contains the SharedCounter distributed data structure
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH;;;;;GAKG;AAEH,4CAA0B;AAC1B,+CAA6B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This package contains the {@link SharedCounter} distributed data structure.\n * A `SharedCounter` is a shared object which holds a whole number that can be incremented or decremented.\n *\n * @packageDocumentation\n */\n\nexport * from \"./counter\";\nexport * from \"./interfaces\";\n"]}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base";
|
|
6
6
|
/**
|
|
7
|
-
* Events sent by
|
|
7
|
+
* Events sent by {@link SharedCounter}.
|
|
8
|
+
*
|
|
8
9
|
* @public
|
|
9
10
|
*/
|
|
10
11
|
export interface ISharedCounterEvents extends ISharedObjectEvents {
|
|
@@ -19,18 +20,22 @@ export interface ISharedCounterEvents extends ISharedObjectEvents {
|
|
|
19
20
|
(event: "incremented", listener: (incrementAmount: number, newValue: number) => void): any;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
|
-
* SharedCounter interface.
|
|
23
|
+
* {@link SharedCounter} interface.
|
|
24
|
+
*
|
|
23
25
|
* @public
|
|
24
26
|
*/
|
|
25
27
|
export interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {
|
|
26
28
|
/**
|
|
27
29
|
* The counter value.
|
|
30
|
+
*
|
|
31
|
+
* @remarks Must be a whole number.
|
|
28
32
|
*/
|
|
29
33
|
value: number;
|
|
30
34
|
/**
|
|
31
|
-
* Increments or decrements the value.
|
|
35
|
+
* Increments or decrements the value.
|
|
36
|
+
* Must only increment or decrement by a whole number value.
|
|
32
37
|
*
|
|
33
|
-
* @param incrementAmount -
|
|
38
|
+
* @param incrementAmount - A whole number to increment or decrement by.
|
|
34
39
|
*/
|
|
35
40
|
increment(incrementAmount: number): void;
|
|
36
41
|
}
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAExF
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAExF;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC7D;;;;;;;OAOG;IACH,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,OAAE;CACzF;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IACvE;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,SAAS,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5C"}
|
package/dist/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISharedObject, ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\n\n/**\n * Events sent by
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISharedObject, ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\n\n/**\n * Events sent by {@link SharedCounter}.\n *\n * @public\n */\nexport interface ISharedCounterEvents extends ISharedObjectEvents {\n /**\n * This event is raised when the counter is incremented or decremented.\n *\n * @param event - The event name.\n * @param listener - An event listener.\n *\n * @eventProperty\n */\n (event: \"incremented\", listener: (incrementAmount: number, newValue: number) => void);\n}\n\n/**\n * {@link SharedCounter} interface.\n *\n * @public\n */\nexport interface ISharedCounter extends ISharedObject<ISharedCounterEvents> {\n /**\n * The counter value.\n *\n * @remarks Must be a whole number.\n */\n value: number;\n\n /**\n * Increments or decrements the value.\n * Must only increment or decrement by a whole number value.\n *\n * @param incrementAmount - A whole number to increment or decrement by.\n */\n increment(incrementAmount: number): void;\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/counter";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-internal.1.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.1.1.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,4BAA4B,CAAC;AACjD,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,4BAA4B,CAAC;AACjD,eAAO,MAAM,UAAU,yBAAyB,CAAC"}
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/counter";
|
|
11
|
-
exports.pkgVersion = "2.0.0-internal.1.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.1.1.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,yBAAyB,CAAC;AACpC,QAAA,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,yBAAyB,CAAC;AACpC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/counter\";\nexport const pkgVersion = \"2.0.0-internal.1.1.0\";\n"]}
|