-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from starkland/layout-v2
Layout v2
- Loading branch information
Showing
17 changed files
with
559 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
language: node_js | ||
node_js: | ||
- '8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.