TonyS
Posts: 0
Joined: Thu Jun 11, 2015 12:11 pm

Global functionality

I'm want a function that checks the remote DB for changes and notifies the user when there are whatever page the are on. Currently the check is only made on the home page when the user opens the app. 2 things; do I have to repeat the function on every page and how do I trigger the check, a timer?

Thanks

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Global functionality

Hello Tony,

Please try to use following JS code to create global service(this code you need to add to your new JS asset):

prevar onLoad = function(){
console.log("onloaded");
//Where "ToDoDB_dogs_list_service" is your service.
//and "yourGlobalServiceDataSourceName" will be your global service datasource.
window.yourGlobalServiceDataSourceName = new Apperyio.DataSource(ToDoDB_dogs_list_service, {
"onBeforeSend": function(jqXHR) {
},
"onComplete": function(jqXHR, textStatus) {
},
"onSuccess": function(data) {
},
"onError": function(jqXHR, textStatus, errorThrown) {}
});
};
jQuery(window).load(onLoad);/pre

Then you can invoke your global service with following JS code:

preyourGlobalServiceDataSourceName.execute();/pre

TonyS
Posts: 0
Joined: Thu Jun 11, 2015 12:11 pm

Global functionality

Thanks you:)

Julian De La Rosa
Posts: 0
Joined: Sat Apr 19, 2014 12:28 am

Global functionality

Also if you use template in platform you can put the function there and will be inherited by all pages.

Return to “Issues”