Skip to content

Instantly share code, notes, and snippets.

@irodkin
Created February 9, 2018 15:04
Show Gist options
  • Save irodkin/980503f7ee6ad0843f47c2e4f7dcccb7 to your computer and use it in GitHub Desktop.
Save irodkin/980503f7ee6ad0843f47c2e4f7dcccb7 to your computer and use it in GitHub Desktop.
What's better - to define function inside object definition or outside?
if(App.app_settings.requests == undefined) App.app_settings.requests = {};
App.app_settings.requests.getAppData = function(id, settings){
this.apiRequest({
type: 'GET',
url: 'app_settings/getAppData',
data: {id: id},
error: settings.error,
success: settings.success
});
}
//
//or that way
//
if(App.app_settings.requests == undefined) App.app_settings.requests = {
getAppData: function(id, settings){
this.apiRequest({
type: 'GET',
url: 'app_settings/getAppData',
data: {id: id},
error: settings.error,
success: settings.success
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment