Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new methods to cartoDB layer #2111

Merged
merged 2 commits into from
May 10, 2018
Merged

Add new methods to cartoDB layer #2111

merged 2 commits into from
May 10, 2018

Conversation

IagoLast
Copy link
Contributor

@IagoLast IagoLast commented May 7, 2018

@@ -147,6 +147,16 @@ var CartoDBLayer = LayerModelBase.extend({
remove: function () {
this.getSource().unmarkAsSourceOf(this);
LayerModelBase.prototype.remove.apply(this, arguments);
},

$getTableName: function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add some tests for $getTableName and $getApiKey.

In addition, but this is a personal opinion, I would return null if there are not this.attributes.source.attributes.options. If the result of this function is assigned to a value, this value would be undefined, and I consider that is more correct to set it to null instead of undefined.

},

$getTableName: function () {
if (this.attributes.source.attributes.options) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  • Instead of accessing this.attributes use the get method (general tip for Backbone models). In this case, you can use the existing getSource().
  • This is an internal class and we are not following the $ convention that we use in the public API.

},

getTableName: function () {
if (this.get('source').has('options')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IagoLast IagoLast merged commit 0d568b6 into master May 10, 2018
@IagoLast IagoLast deleted the support-1399 branch May 10, 2018 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants