cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Auto-refresh associate with function

FredSilva92
5-Regular Member

Auto-refresh associate with function

Hello Ptc community,

I created a model and some javascript logic to show an image when a certain property is updated on a thing (on thingworx side). I would like if it is possible to associate a javascript function when a thing property auto refreshes.

Thanks a lot,
Frederico Silva

1 REPLY 1

@FredSilva92 ,

in case that your question is how to start some function when a value in TWX change - you can use:

.1) pay attention that the property will update in the Vuforia Experience project  and has binding to an app parameter:

2020-12-04_15-45-56.jpg

2.) use a watch block to watch  the change of the app parameter:

//what the app parameter prop1
$scope.$watch('app.params.prop1', function (newValue, oldValue, scope) {
console.log("Old Value -befor it was changed =" + oldValue); 
//! it could be undefined first time called
console.log("new  Value -after it was changed =" + newValue); 
//prints the current $scope (copy) object passed to the $watch construct
// pay attention that in this context it has no $ ! e.g. console.warn(scope);

//call your function / action which should  do some tasks for 
// the change of the prop1 app parameter 
})

 

Top Tags