koopjs / featureservice

Get all features from an Esri Feature Service.
Other
22 stars 3 forks source link

Problems using featureservice in browser #19

Open mjuniper opened 9 years ago

mjuniper commented 9 years ago

I am trying to use this in an ember-cli app.

First I tried loading it using ember-browserify because, it seems to me, that's the best way to load an npm module into an ember-cli app. When I called pages, I got "req.setTimeout is not a function". I wonder if I would need to provide browserify options to ember-browserify to make this work? You can see this in this branch: https://github.com/mjuniper/opendata-ember/tree/featureservice-ember-browserify by going to http://localhost:4200/datasets?q= and clicking on a dataset in the table.

Then, I tried loading the browser distribution from /dist. The only way I could figure out how to do that in the context of ember-cli was to copy the file to the vendor directory and then call app.import('vendor/featureservice.min.js'); in ember-cli-build.js which is horrible. In this case, when I call pages, it makes a request to port 443 even though it is an http url. This request eventually times out. You can see this in this branch: https://github.com/mjuniper/opendata-ember/tree/featureservice-vendor by going to http://localhost:4200/datasets?q= and clicking on a dataset in the table.

I'm willing to help fix it but I'd first like to hear people's thoughts. @chelm, @ngoldman, @dmfenton

dmfenton commented 9 years ago

@mjuniper I'm happy to (have you) modify the code to make it work better in browsers.

I'm interested to hear more about your use case for pulling this into a browser. Bigger picture, what do we need to add or change?

chelm commented 9 years ago

the code forces https requests to all hosted services (at least it should) where https should always be enabled. If its not then its a bug.