add javascript files only when plugin is called?

If your scripts can be printed in the footer add the enqueue to the definition of getDeck, with the final argument set to true.

I.e in your plugin file

function getDeck( $deckId )
{
    wp_enqueue_script( $handle, $src, $deps, $ver, true );

    //do other stuff
}