This file contains hidden or 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
| if ('serviceWorker' in navigator) { | |
| window.addEventListener('load', function() { | |
| navigator.serviceWorker.register('/sw.js') | |
| .then(function(registration) { | |
| // Registration was successful | |
| console.log('ServiceWorker registration successful with scope: ', registration.scope); | |
| }).catch(function(err) { | |
| // registration failed :( |
This file contains hidden or 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
| const VERSION = 'v1'; | |
| var urlsToCache = [ | |
| '/', | |
| '/styles/main.css', | |
| '/script/main.js' | |
| ]; | |
| self.addEventListener('install', function(event) { | |
| // Perform install steps |
This file contains hidden or 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
| // Create new database | |
| const db = new PouchDB('mydb'); | |
| // Put new record to database | |
| db.put({ | |
| _id: '[email protected]', | |
| firstName: 'Jon', | |
| lastName: 'Doe' | |
| }); |
This file contains hidden or 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
| self.addEventListener('push', (event) => { | |
| const title = 'New notification'; | |
| const body = 'We have received a push notification.'; | |
| const icon = '/app-icon-192.png'; | |
| const tag = 'push-notification-tag'; | |
| event.waitUntil( | |
| self.registration.showNotification(title, { | |
| body, | |
| icon, |
This file contains hidden or 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
| self.addEventListener('notificationclick', (event) => { | |
| // Android doesn’t close the notification when you click on it | |
| // See: http://crbug.com/463146 | |
| event.notification.close(); | |
| // Do some stuff | |
| }); |
This file contains hidden or 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
| ├── /base | |
| │ ├── _core.scss | |
| │ ├── _colors.scss | |
| │ ├── _settings.scss | |
| │ └── _typography.scss | |
| ├── /utils | |
| │ ├── _animations.scss | |
| │ ├── _easings.scss | |
| │ ├── _grid.scss | |
| │ └── _misc.scss |
This file contains hidden or 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
| // *** Vendor *** | |
| @import 'sanitize.css'; | |
| // *** Settings *** | |
| @import './base/settings'; | |
| @import './base/colors'; | |
| // *** Utils *** | |
| @import './utils/easings'; | |
| @import './utils/animations'; |
This file contains hidden or 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
| // Names | |
| $white: #fff; | |
| $black: #000; | |
| $aquamarine: #7fffd4; | |
| $alabaster: #f9f9f9; | |
| $alto: #d9d9d9; | |
| $mine-shaft: #333; | |
| // Roles |
This file contains hidden or 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
| // Bad | |
| .article { | |
| .title { | |
| color: $accent; | |
| } | |
| .text { | |
| color: $text; | |
| .img { |
This file contains hidden or 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
| .link { | |
| &:hover { | |
| color: $accent; | |
| } | |
| &::after { | |
| display: inline-block; | |
| content: '\0362'; | |
| vertical-align: middle; | |
| } |