I'm trying to assign myShuttle.command to a string called signIn which is being stored in the shuttleCommands function.
function buildAndLaunchSignInShuttle (credentialsDoc) {
var myShuttle = new shuttle();
myShuttle.command = shuttleCommands.signIn;
myShuttle.document = credentialsDoc;
var responseObject = server.launchShuttle(myShuttle);
return responseObject;
}
function shuttleCommands() {
return {
signIn: "signIn",
signOut: "signOut",
getEntireCollection: "getEntireCollection",
getSingleDocument: "getSingleDocument",
saveDocument: "saveDocument"
};
}
How do I go about doing this? I don't really know what the right way of phrasing this is which is hindering my Googling!
shuttleCommandsis a function. Drop the function ceremony and make it an object literal.shuttleCommandsfirst...shuttleCommandsis a function. You have to run it for it to return the object with what you're trying to get.