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-45Lines changed: 49 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,28 +4,27 @@
4
4
5
5
# Parameters
6
6
7
-
## Plugin global config
8
-
9
-
-`options`: **SWD Plugin Only** an object containing any Sustainable Web Design specific variables to the changed. All keys are optional.
10
-
-`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
-
-`returnVisitPercentage` - a value between 0 and 1 representing the percentage of returning visitors.
12
-
-`gridIntensity` - an object that can contain the following optional keys:
13
-
-`device` - 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.
14
-
-`dataCenter` - 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.
15
-
-`networks` - 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.
16
-
17
-
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
-
19
7
## Plugin node config
20
8
21
9
-`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
10
+
-`green-web-host`: true if the website is hosted on a green web host, false otherwise (has to be provided either as config or input)
23
11
24
12
## Inputs
25
13
26
14
-`network/data/bytes`: the number of bytes transferred or `network/data` if the number is in GB
15
+
-`green-web-host`: true if the website is hosted on a green web host, false otherwise (has to be provided either as config or input)
27
16
-`duration`: the amount of time the observation covers, in seconds
28
17
-`timestamp`: a timestamp for the observation
18
+
-`options`: **SWD Plugin Only** an object containing any Sustainable Web Design specific variables to the changed. All keys are optional.
19
+
-`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.
20
+
-`returnVisitPercentage` - a value between 0 and 1 representing the percentage of returning visitors.
21
+
-`gridIntensity` - an object that can contain the following optional keys:
22
+
-`device` - 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.
23
+
-`dataCenter` - 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.
24
+
-`networks` - 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.
25
+
26
+
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.
27
+
29
28
30
29
## Returns
31
30
@@ -58,15 +57,6 @@ initialize:
58
57
co2js:
59
58
method: Co2js
60
59
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'
70
60
tree:
71
61
children:
72
62
child:
@@ -80,6 +70,14 @@ tree:
80
70
- timestamp: 2023-07-06T00:00
81
71
duration: 1
82
72
network/data/bytes: 1000000
73
+
options:
74
+
dataReloadRatio: 0.6
75
+
firstVisitPercentage: 0.9
76
+
returnVisitPercentage: 0.1
77
+
gridIntensity:
78
+
device: 560.98
79
+
dataCenter:
80
+
country: 'TWN'
83
81
```
84
82
85
83
You can run this by passing it to `ie`. Run impact using the following command run from the project root:
@@ -101,15 +99,6 @@ initialize:
101
99
co2js:
102
100
path: '@grnsft/if-unofficial-plugins'
103
101
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
113
102
tree:
114
103
children:
115
104
child:
@@ -123,11 +112,28 @@ tree:
123
112
- timestamp: 2023-07-06T00:00
124
113
duration: 1
125
114
network/data/bytes: 1000000
115
+
options:
116
+
dataReloadRatio: 0.6
117
+
firstVisitPercentage: 0.9
118
+
returnVisitPercentage: 0.1
119
+
gridIntensity:
120
+
device: 560.98
121
+
dataCenter:
122
+
country: TWN
126
123
outputs:
127
124
- timestamp: 2023-07-06T00:00
128
125
duration: 1
129
126
network/data/bytes: 1000000
130
127
carbon-operational: 0.34497244224000007
128
+
green-web-host: true
129
+
options:
130
+
dataReloadRatio: 0.6
131
+
firstVisitPercentage: 0.9
132
+
returnVisitPercentage: 0.1
133
+
gridIntensity:
134
+
device: 560.98
135
+
dataCenter:
136
+
country: TWN
131
137
```
132
138
133
139
## TypeScript
@@ -139,26 +145,24 @@ You can see example Typescript invocations for each plugin below.
139
145
```typescript
140
146
import {Co2js} from '@grnsft/if-unofficial-plugins';
0 commit comments