Api command executes hundred times by itself after reload the api!


(Kanoute13) #1

When i execute a command for apply texture i.e., lets say set material command through a button (jquery )
this command execute 2,3 or more times or sometimes like hundred times.

This thing happening when i change object . The way that i change object is through recall the client with different urlid this time.

Does anyone faced the same problem or know for which reason this thing happening?


(Kanoute13) #2

SELF HINT!

i think is because i cal the client without stopping the previous, so its like the run the same time!


(Kanoute13) #3

Solved it.

you have to do it like this:

var client=null;

function initViewer(urlid) {
var client = new Sketchfab(version, iframe);
client.init(urlid, {
//YOUR CODE HERE
}
so every time that you call the initViewer with new url you restart the client


#4

Glad you got it working!