0.0.13 • Published 9 years ago

ember-cli-geolocation v0.0.13

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

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 'ember-cli-geolocation/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
        self.get('geolocation').on('change', function(geoposition){
            console.log(geoposition);
        });

        self.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

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.

0.0.13

9 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago