You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/lib/co2js/README.md
+49-43Lines changed: 49 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,16 @@
4
4
5
5
# Parameters
6
6
7
-
## Plugin global config
7
+
## Plugin node config
8
+
9
+
-`type`: supported plugins by the library, `swd` or `1byte`
8
10
11
+
## Inputs
12
+
13
+
-`network/data/bytes`: the number of bytes transferred or `network/data` if the number is in GB
14
+
-`green-web-host`: true if the website is hosted on a green web host, false otherwise
15
+
-`duration`: the amount of time the observation covers, in seconds
16
+
-`timestamp`: a timestamp for the observation
9
17
-`options`: **SWD Plugin Only** an object containing any Sustainable Web Design specific variables to the changed. All keys are optional.
10
18
-`dataReloadRatio` - a value between 0 and 1 representing the percentage of data that is downloaded by return visitors. -`firstVisitPercentage` - a value between 0 and 1 representing the percentage of new visitors.
11
19
-`returnVisitPercentage` - a value between 0 and 1 representing the percentage of returning visitors.
@@ -16,16 +24,6 @@
16
24
17
25
The value for `device`, `dataCenter`, or `networks` can be a number representing the carbon intensity for the given segment (in grams per kilowatt-hour). Or, an object, which contains a key of country and a value that is an Alpha-3 ISO country code.
18
26
19
-
## Plugin node config
20
-
21
-
-`type`: supported plugins by the library, `swd` or `1byte`
22
-
-`green-web-host`: true if the website is hosted on a green web host, false otherwise
23
-
24
-
## Inputs
25
-
26
-
-`network/data/bytes`: the number of bytes transferred or `network/data` if the number is in GB
27
-
-`duration`: the amount of time the observation covers, in seconds
28
-
-`timestamp`: a timestamp for the observation
29
27
30
28
## Returns
31
29
@@ -58,15 +56,8 @@ initialize:
58
56
co2js:
59
57
method: Co2js
60
58
path: '@grnsft/if-unofficial-plugins'
61
-
global-config:
62
-
options:
63
-
dataReloadRatio: 0.6
64
-
firstVisitPercentage: 0.9
65
-
returnVisitPercentage: 0.1
66
-
gridIntensity:
67
-
device: 560.98
68
-
dataCenter:
69
-
country: 'TWN'
59
+
outputs:
60
+
- yaml
70
61
tree:
71
62
children:
72
63
child:
@@ -80,6 +71,14 @@ tree:
80
71
- timestamp: 2023-07-06T00:00
81
72
duration: 1
82
73
network/data/bytes: 1000000
74
+
options:
75
+
dataReloadRatio: 0.6
76
+
firstVisitPercentage: 0.9
77
+
returnVisitPercentage: 0.1
78
+
gridIntensity:
79
+
device: 560.98
80
+
dataCenter:
81
+
country: 'TWN'
83
82
```
84
83
85
84
You can run this by passing it to `ie`. Run impact using the following command run from the project root:
@@ -101,15 +100,8 @@ initialize:
101
100
co2js:
102
101
path: '@grnsft/if-unofficial-plugins'
103
102
method: Co2js
104
-
global-config:
105
-
options:
106
-
dataReloadRatio: 0.6
107
-
firstVisitPercentage: 0.9
108
-
returnVisitPercentage: 0.1
109
-
gridIntensity:
110
-
device: 560.98
111
-
dataCenter:
112
-
country: TWN
103
+
outputs:
104
+
- yaml
113
105
tree:
114
106
children:
115
107
child:
@@ -123,10 +115,26 @@ tree:
123
115
- timestamp: 2023-07-06T00:00
124
116
duration: 1
125
117
network/data/bytes: 1000000
118
+
options:
119
+
dataReloadRatio: 0.6
120
+
firstVisitPercentage: 0.9
121
+
returnVisitPercentage: 0.1
122
+
gridIntensity:
123
+
device: 560.98
124
+
dataCenter:
125
+
country: TWN
126
126
outputs:
127
127
- timestamp: 2023-07-06T00:00
128
128
duration: 1
129
129
network/data/bytes: 1000000
130
+
options:
131
+
dataReloadRatio: 0.6
132
+
firstVisitPercentage: 0.9
133
+
returnVisitPercentage: 0.1
134
+
gridIntensity:
135
+
device: 560.98
136
+
dataCenter:
137
+
country: TWN
130
138
carbon-operational: 0.34497244224000007
131
139
```
132
140
@@ -139,26 +147,24 @@ You can see example Typescript invocations for each plugin below.
139
147
```typescript
140
148
import {Co2js} from '@grnsft/if-unofficial-plugins';
0 commit comments