Last active
October 25, 2017 02:28
-
-
Save r3-yamauchi/ea9ac35d3908df7d9e03b4c90bb8df78 to your computer and use it in GitHub Desktop.
Cloud Firestore を使って kintone へ プッシュ通知する https://blog.r3it.com/cloud-firestore-with-kintone-aaa50fcea1c7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
"use strict"; | |
firebase.initializeApp({ | |
apiKey: "XXxxXxXXXx99x9XX-xxx_xxXxXXXXXXxXXxXXxX", | |
authDomain: "projectId.firebaseapp.com", | |
projectId: "projectId" | |
}); | |
// Initialize Cloud Firestore through Firebase | |
var db = firebase.firestore(); | |
kintone.events.on("app.record.index.show", function (e) { | |
db.collection("users").doc("user1").collection("documents") | |
.onSnapshot(function (snapshot) { | |
snapshot.forEach(function (doc) { | |
var data = doc.data(); | |
console.log(doc.id, " => ", data["content"]); | |
}); | |
}, function (error) { | |
console.dir(error); | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment