Reputation: 71
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!
Upvotes: 0
Views: 34
Reputation: 44376
myShuttle.command = shuttleCommands.signIn;
This will assign myShuttle.command to the signIn attribute of the shuttleCommands function itself, which is probably undefined.
I think you want to assign myShuttle.command to the signIn attribute of the value returned by the shuttleCommands function, which would be
myShuttle.command = shuttleCommands().signIn;
Upvotes: 1