Viewer api. multiple calls


(Miekeroth) #1

Hi all and probably especcially @james ,

I am working on a design of an application in which I want to be able to make several calls to the api. So, for example, combining the upcoming animation with the possibility to change textures. If this would be possible, it would help a whole lot to make great applications!


#2

Hi :smile:

I'm not sure exactly what you mean. What's stopping you from making several calls?

function multipleCalls() {
  api.addTexture(
    'https://example.org/texture.png',
    function ( err, textureUid ) {
        console.log( 'New texture registered with ID ' + textureUid );
    }
  );
  api.playAnimation( blah );
}

$( '#button' ).on( 'click', multipleCalls );

(Miekeroth) #3

OK! That's what I wanted to know :wink:


#4

Just make sure you declare/define the api object globally (or whatever scope you need). Then you can call it as needed from anywhere.


(Miekeroth) #5

Cool, haven't thought that far ahead yet (about declaring it globally), but that will make things easier.


(Edsahergom) #6

Hello, I am trying to call different urlids when onclick but it doesnt let me.

Any ideas.

Thank you.


#7

I'm not sure I understand. Can you elaborate on what you're trying to do?