ecg

ember-cli-geolocation

Geolocation addon

Showing:

Popularity

Downloads/wk

1

GitHub Stars

9

Maintenance

Last Commit

7yrs ago

Contributors

2

Package

Dependencies

0

Size (min+gzip)

0.2KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

ember-cli-geolocation Build Status

Addon provides property into routes and controllers to get geo-location information (e.g. coords.)

Installation

npm install --save-dev ember-cli-geolocation
ember generate ember-cli-geolocation

Usage

Available as mixin, you can use like that:

import Ember from 'ember';
import GeoLocationMixin from '{YOUR PROJECTS NAME}/mixins/geolocation-mixin';

// Some controller
export default Ember.Controller.extend(GeoLocationMixin, {

    // Init method for example
    init: function() {
        // Super calling
        this._super();

        // Begin geo location inquiry
        this.get('geolocation').start();

        // For example use interval function (every 1s), because
        // geolocation become available with delay
        setInterval(Ember.run.bind(this, function() {
            // Attribute position computed by geolocation.geoposition
            console.log(this.get('position'));
        }), 1000);

        // You can use event handlers
        this.get('geolocation').on('change', function(geoposition){
            console.log(geoposition);
        });

        this.get('geolocation').on('error', function(){
            console.log("SOME ERR");
        });

        // Or you can simply do like that
        this.get('geolocation').getGeoposition().then(function(geoposition) {
            console.log(geoposition);
        });

        // After 30 sec. stop geo location inquiry
        setInterval(Ember.run.bind(this, function() {
            // Make it stop
            this.get('geolocation').stop();
        }), 30000);
    }
});

Running

  • ember server
  • Visit your app at http://localhost:4200.

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/. Addon based on geoPosition.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial