Created
February 9, 2018 15:04
-
-
Save irodkin/980503f7ee6ad0843f47c2e4f7dcccb7 to your computer and use it in GitHub Desktop.
What's better - to define function inside object definition or outside?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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