Skip to content

Commit

Permalink
Merge pull request #20 from starkland/layout-v2
Browse files Browse the repository at this point in the history
Layout v2
  • Loading branch information
thulioph authored Jun 28, 2017
2 parents 39fef91 + 7128e19 commit 0f1a286
Show file tree
Hide file tree
Showing 17 changed files with 559 additions and 303 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- '8'
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Setup

[![Build Status](https://travis-ci.org/starkland/omosca.svg?branch=master)](https://travis-ci.org/starkland/omosca) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/068eb7197685459ab73321ffeb139c1c)](https://www.codacy.com/app/Starkland/omosca?utm_source=github.com&utm_medium=referral&utm_content=starkland/omosca&utm_campaign=Badge_Grade)


``` bash
# install dependencies
npm install
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "omosca",
"version": "1.0.0",
"version": "2.0.0",
"description": "O mosca landing page.",
"author": "thulioph <thulioph@gmail.com>",
"private": true,
Expand Down
37 changes: 37 additions & 0 deletions src/assets/js/Location.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class Location {
constructor() {
this.geolocation = navigator.geolocation;
}

get() {
if (this.geolocation) {
this.geolocation.getCurrentPosition(
(position) => {
this.position = [
position.coords.latitude,
position.coords.longitude,
];

this.timestamp = position.timestamp;

this.setGeolocation();
},

(err) => {
throw new Error(`${err}`);
},
);
}
}

setGeolocation() {
const obj = {
position: this.position,
timestamp: this.timestamp,
};

console.warn(`Send to firebase this data: ${obj}`);
}
}

export default Location;
36 changes: 36 additions & 0 deletions src/assets/js/Notification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
class Notification {
constructor() {
this.errorMessage = 'Seu browser não suporta notificações.';
this.permission = '';
}

get() {
if (!('Notification' in window)) {
throw new Error(this.errorMessage);
} else {
window.Notification.requestPermission((permission) => {
this.permission = permission;
this.setPermission();
});
}
}

setPermission() {
const value = this.permission;

switch (value) {
case 'denied':
console.warn('denied');
break;

case 'granted':
console.warn('granted');
break;

default:
break;
}
}
}

export default Notification;
Loading

0 comments on commit 0f1a286

Please sign in to comment.