我正在使用最近发布的FCM消息传递支持Chrome上的推送通知.当我的应用程序在后台时,我收到通知,但是当我点击通知时没有任何反应.如何指定用户单击通知时应打开的URL?(我理解如何使用notificationclick事件使用纯服务工作者概念完成,我想知道如何使用FCM消息传递.)
messaging.setBackgroundMessageHandler(function(payload) {
var data = payload || {};
var shinyData = decoder.run(data);
console.log('[firebase-messaging-sw.js] Received background message ', shinyData);
return self.registration.showNotification(shinyData.title, {
body: shinyData.body,
icon: shinyData.icon
})
});
Run Code Online (Sandbox Code Playgroud)
我在这里错过了什么?
push-notification firebase service-worker web-push firebase-cloud-messaging
我正在尝试删除边缘并在两个顶点之间添加新边.我如何在Tinkerpop3中做到这一点?
def user = g.V().has("userId", 'iamuser42').has("tenantId", 'testtenant').hasLabel('User');
user.outE("is_invited_to_join").where(otherV().has("groupId", 'test123')).drop();
def group = g.V().has("groupId", 'test123').has("tenantId", 'testtenant').hasLabel('Group').next();
user.addEdge("is_member_of", group);
Run Code Online (Sandbox Code Playgroud)
这是我在gremlin shell上遇到的错误:
No signature of method: org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal.addEdge() is applicable for argument types: (java.lang.String, com.thinkaurelius.titan.graphdb.vertices.CacheVertex) values: [is_member_of, v[8224]]
Run Code Online (Sandbox Code Playgroud)
谢谢.
在 Tinkerpop3 valueMap 返回一个数组时,如何获得真正的键值对(没有数组)?
gremlin> Gremlin.version()
==>3.0.1-incubating
:> def trav = g.V().hasLabel('Group'); trav.valueMap()
==>{joinTime=[2016-12-05T22:27:01.088Z], groupId=[9de5-45cf-b40d-e357b40e87b1], mCanInvite=[true]}
:> def trav = g.V().hasLabel('Group'); trav.local(properties().group().by(key()).by(value()))
==>{joinTime={2016-12-05T22:27:01.088Z=1}, groupId={9de5-45cf-b40d-e357b40e87b1=1}, mCanInvite={true=1}
Run Code Online (Sandbox Code Playgroud) 此代码段有助于将应用程序选项卡置于焦点或使用该URL打开新选项卡.如果选项卡已打开,是否可以更改URL(基于用户单击的通知).
event.waitUntil(
clients.matchAll({
type: 'window'
})
.then(function(windowClients) {
for (var i = 0; i < windowClients.length; i++) {
var client = windowClients[i];
if (url.test(client.url) && 'focus' in client) {
return client.focus();
}
}
if (clients.openWindow) {
return clients.openWindow('/#/chat');
}
})
);
Run Code Online (Sandbox Code Playgroud)