Commit c4c99419 authored by Phuengton Chummuel's avatar Phuengton Chummuel

add generateid function

parent 4a4a8559
...@@ -58,3 +58,14 @@ export function appointmentNotification(message, date, id, payload) { ...@@ -58,3 +58,14 @@ export function appointmentNotification(message, date, id, payload) {
export function cancleNotification(id) { export function cancleNotification(id) {
PushNotification.cancelLocalNotifications({ id: id }); PushNotification.cancelLocalNotifications({ id: id });
} }
export function generateID() {
let d = new Date().getTime();
let id = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
let r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(5);
});
return id;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment