Я бы порекомендовал использовать рабочий текст nativescript
https://docs.nativescript.org/core-concepts/multithreading-model
и плагин nativescript-local-notifications
в вашем ./worker/sendpush.js
require('globals');
var notification = require("nativescript-local-notifications");
onmessage = function(msg){
if(msg.data.success == true)
{
notification.schedule([{
id : 1,
title: 'New message',
badge : 1,
body: data.msg,
smallIcon : 'res://icon'
]).then(function() {
console.log("Notification scheduled");
},function(error) {
console.log("scheduling error: " + error);
})
}
на главной странице.js
var getloc = new Worker("./workers/get-location");
getloc.postMessage({msg : "blabla", success : true});