Skip to content

Instantly share code, notes, and snippets.

@r3-yamauchi
Last active October 25, 2017 02:28
Show Gist options
  • Save r3-yamauchi/ea9ac35d3908df7d9e03b4c90bb8df78 to your computer and use it in GitHub Desktop.
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
(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