FirebaseExtended / firebase-queue

MIT License
786 stars 108 forks source link

Possible to grab the taskId generated by Firebase? #29

Closed henry74 closed 9 years ago

henry74 commented 9 years ago

I'd like to leverage the unique id created by Firebase when pushing a task on the queue. Is it possible to extract this from the data from the worker side or does it need to be explicitly added to the data payload?

cbraynor commented 9 years ago

The client that added it generates the ID, so you can always put that info in the task itself.

Assuming you're using the JavaScript SDK (the others are only syntactically different), instead of calling

tasksRef.push({
  your: 'task'
});

You could:

var task = tasksRef.push(); // A client-only command
task.set({
  your: 'task',
  id: task.key();
});