我是firebase的新手,在web上开始使用firebase实时数据库。我写了以下代码来展示一个视频。但代码不起作用
<pre id="object"></pre>
<script>
(function (){
// Initialize Firebase
var config = {
apiKey: "<API KEY>",
authDomain: "test-2c44d.firebaseapp.com",
databaseURL: "https://test-2c44d.firebaseio.com",
projectId: "test-2c44d",
storageBucket: "test-2c44d.appspot.com",
messagingSenderId: "329022996031"
};
firebase.initializeApp(config);
const preObject = document.getElementById('object');
const dbRefObject = firebase.database().ref().child('object');
dbRefObject.on('value',snap => console.log(snap.val()));
}());
</script>