Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-cli-geolocation

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-geolocation

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

  • 0.0.13
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 16 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc