@@ -3,15 +3,33 @@ import FloatToolkitCore from "@float-toolkit/core";
33
44import { versionNumbers } from "./versionNumbers" ;
55
6+ /**
7+ * An Angular injectable (service) that implements FloatToolkit methods and an `output` property.
8+ *
9+ * @example
10+ * import { FloatToolkit } from "@float-toolkit/angular";
11+ *
12+ * \@Component({...})
13+ * export class SumComponent {
14+ * constructor(private ft: FloatToolkit) {}
15+ * }
16+ */
617@Injectable ( { providedIn : "root" } )
718class FloatToolkit {
819 private readonly ft = new FloatToolkitCore ( ) ;
920 private _output = 0 ;
1021
22+ /**
23+ * A reactive state property containing the returned value of the last method called.
24+ */
1125 get output ( ) : number {
1226 return this . _output ;
1327 }
1428
29+ /**
30+ * An integer between 1 and 17.
31+ * Defines the precision (number of decimals) to use by default, if the precision is not specified in the method itself.
32+ */
1533 get defaultPrecision ( ) : FloatToolkit . Precision {
1634 return this . ft . defaultPrecision ;
1735 }
@@ -20,6 +38,9 @@ class FloatToolkit {
2038 this . ft . defaultPrecision = newPrecision ;
2139 }
2240
41+ /**
42+ * The options object used in the service.
43+ */
2344 get options ( ) : FloatToolkit . Options {
2445 return this . ft . options ;
2546 }
@@ -69,17 +90,35 @@ class FloatToolkit {
6990 return result ;
7091 }
7192
93+ /**
94+ * Resets the output to 0.
95+ */
7296 resetOutput ( ) : void {
7397 this . _output = 0 ;
7498 }
7599}
76100
77101namespace FloatToolkit {
102+ /**
103+ * An integer between 1 and 17, which can be used as the default precision for the `FloatToolkit` service.
104+ */
78105 export type Precision = FloatToolkitCore . Precision ;
106+
107+ /**
108+ * Options that can be set to modify the behavior of the `FloatToolkit` service.
109+ */
79110 export interface Options extends FloatToolkitCore . Options { }
111+
112+ /**
113+ * An object containing the version of a FloatToolkit package.
114+ */
80115 export interface Version extends FloatToolkitCore . Version { }
81116
117+ /**
118+ * Contains the version of `@float-toolkit/core` used by the Angular service.
119+ */
82120 export const CORE_VERSION : Version = FloatToolkitCore . VERSION ;
121+
83122 export const VERSION : Version = {
84123 get full ( ) {
85124 return versionNumbers . join ( "." ) ;
0 commit comments