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
+55-48Lines changed: 55 additions & 48 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:
@@ -75,11 +66,19 @@ tree:
75
66
config:
76
67
co2js:
77
68
type: swd
78
-
green-web-host: true
79
69
inputs:
80
70
- timestamp: 2023-07-06T00:00
81
71
duration: 1
82
72
network/data/bytes: 1000000
73
+
green-web-host: true
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:
@@ -118,15 +110,32 @@ tree:
118
110
config:
119
111
co2js:
120
112
type: swd
121
-
green-web-host: true
122
113
inputs:
123
114
- timestamp: 2023-07-06T00:00
124
115
duration: 1
125
116
network/data/bytes: 1000000
117
+
green-web-host: true
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
+
green-web-host: true
131
+
options:
132
+
dataReloadRatio: 0.6
133
+
firstVisitPercentage: 0.9
134
+
returnVisitPercentage: 0.1
135
+
gridIntensity:
136
+
device: 560.98
137
+
dataCenter:
138
+
country: TWN
130
139
carbon-operational: 0.34497244224000007
131
140
```
132
141
@@ -139,31 +148,29 @@ You can see example Typescript invocations for each plugin below.
139
148
```typescript
140
149
import {Co2js} from '@grnsft/if-unofficial-plugins';
0 commit comments