-
Notifications
You must be signed in to change notification settings - Fork 241
/
index.js
44 lines (39 loc) · 1.07 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import firebase from "firebase";
import "firebase/remote-config";
function getInstance() {
// [START rc_get_instance]
const remoteConfig = firebase.remoteConfig();
// [END rc_get_instance]
}
function setMinimumFetchTime() {
const remoteConfig = firebase.remoteConfig();
// [START rc_set_minimum_fetch_time]
remoteConfig.settings.minimumFetchIntervalMillis = 3600000;
// [END rc_set_minimum_fetch_time]
}
function setDefaultValues() {
const remoteConfig = firebase.remoteConfig();
// [START rc_set_default_values]
remoteConfig.defaultConfig = {
"welcome_message": "Welcome"
};
// [END rc_set_default_values]
}
function getValues() {
const remoteConfig = firebase.remoteConfig();
// [START rc_get_values]
const val = remoteConfig.getValue("welcome_messsage");
// [END rc_get_values]
}
function fetchConfigCallback() {
const remoteConfig = firebase.remoteConfig();
// [START rc_fetch_config_callback]
remoteConfig.fetchAndActivate()
.then(() => {
// ...
})
.catch((err) => {
// ...
});
// [END rc_fetch_config_callback]
}