-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add setter for GeoJsonDataSource.name #5653
Comments
While I have no objections to adding setters to DataSource names (not sure why prevented it in the first place), you are incorrect in that this is a silent failure. It will generate an exception which results in a rejected promise. If you aren't handling promise rejection, then you are ignoring a myriad of possible errors. Here's a Sandcastle example showing the error being raised and handled: |
Hello @burn123. This does currently throw an error because data_promise.then(function(data) {
viewer.dataSources.add(data);
console.log(1);
data.name = "Test";
console.log(2);
}).otherwise(function(error) {
console.log(error);
}); Why would you like to set the name? Right now name only has a getter, but we can consider adding a setter if that would be useful. I'm honestly not really sure what uses |
I put my fail function as the second argument of |
You guys are so fast! Thanks @hpinkos! |
It would be nice to be able to set the name for a DataSource, as currently, an error isn't even thrown, but the code following a call to
data.name
is completely ignored.Consider this code
In this case, the
2
would not get printed, and the name of the dataSource wouldn't get updated. At the very least, I think an error should pop up so that people aren't left wondering why their code isn't executing, but being able to set the name for the layer would be a good thing to have, and should be very easy to implement.The text was updated successfully, but these errors were encountered: