-
Notifications
You must be signed in to change notification settings - Fork 264
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
Conversation
This methods allow to solve https://github.com/CartoDB/support/issues/1399
src/geo/map/cartodb-layer.js
Outdated
@@ -147,6 +147,16 @@ var CartoDBLayer = LayerModelBase.extend({ | |||
remove: function () { | |||
this.getSource().unmarkAsSourceOf(this); | |||
LayerModelBase.prototype.remove.apply(this, arguments); | |||
}, | |||
|
|||
$getTableName: function () { |
There was a problem hiding this comment.
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
.
src/geo/map/cartodb-layer.js
Outdated
}, | ||
|
||
$getTableName: function () { | ||
if (this.attributes.source.attributes.options) { |
There was a problem hiding this comment.
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 theget
method (general tip for Backbone models). In this case, you can use the existinggetSource()
. - 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')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
This methods help to solve https://github.com/CartoDB/support/issues/1399