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
| /** | |
| * Basic example of routerless store based routing. | |
| * To understand what is going on check out | |
| * https://svelte.dev/tutorial/writable-stores | |
| * https://www.npmjs.com/package/feather-route-matcher | |
| */ | |
| // stores.js |
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
| (function (history, trackingId, options) { | |
| const generateId = () => { | |
| return '_' + Math.random().toString(36).substr(2, 9); | |
| }; | |
| const getId = () => { | |
| if (!localStorage.cid) { | |
| localStorage.cid = generateId() | |
| } | |
| return localStorage.cid; | |
| }; |
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
| *, *:before, *:after { | |
| -moz-box-sizing: border-box; | |
| -webkit-box-sizing: border-box; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: 'Lato', sans-serif; | |
| color: #333; | |
| font-weight: 400; |
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 _ = require('lodash'); | |
| module.exports = ({e, addUtilities, config}) => { | |
| const gradients = config('gradients', []) | |
| const variants = config('modules.gradients') | |
| const gradientUtilities = _.map(gradients, (colors, name) => { | |
| if (!_.isArray(colors)) { | |
| colors = ['transparent', colors]; | |
| } |
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
| navigator.serviceWorker.getRegistrations().then(function (registrations) { | |
| if (!registrations.length) { | |
| console.log('No serviceWorker registrations found.') | |
| return | |
| } | |
| for(let registration of registrations) { | |
| registration.unregister().then(function (boolean) { | |
| console.log( | |
| (boolean ? 'Successfully unregistered' : 'Failed to unregister'), 'ServiceWorkerRegistration\n' + | |
| (registration.installing ? ' .installing.scriptURL = ' + registration.installing.scriptURL + '\n' : '') + |
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
| /*! | |
| * Copyright 2015 Google Inc. All rights reserved. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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
| export function observe(key, callback, opts) { | |
| const single = !Array.isArray(key); | |
| const keypaths = single ? [ key ] : key; | |
| const parts = keypaths.map(keypath => keypath.replace(/\[(\d+)\]/g, '.$1').split('.')); | |
| const keys = parts.map(parts => parts[0]); | |
| const fn = callback.bind(this); | |
| let last = parts.map(parts => getNestedValue(this.get(), parts)); | |
| if (!opts || opts.init !== false) { |
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
| export function observe(key, callback, opts) { | |
| const single = !Array.isArray(key); | |
| const keypaths = single ? [ key ] : key; | |
| const parts = keypaths.map(keypath => keypath.replace(/\[(\d+)\]/g, '.$1').split('.')); | |
| const keys = parts.map(parts => parts[0]); | |
| const fn = callback.bind(this); | |
| let last = parts.map(parts => getNestedValue(this.get(), parts)); | |
| if (!opts || opts.init !== false) { |
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
| export function observe(key, callback, opts) { | |
| const single = !Array.isArray(key); | |
| const keypaths = single ? [ key ] : key; | |
| const parts = keypaths.map(keypath => keypath.replace(/\[(\d+)\]/g, '.$1').split('.')); | |
| const keys = parts.map(parts => parts[0]); | |
| const fn = callback.bind(this); | |
| let last = parts.map(parts => getNestedValue(this.get(), parts)); | |
| if (!opts || opts.init !== false) { |
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
| function isMobileDevice() { | |
| return window.matchMedia('(hover: none) and (pointer: coarse)'); | |
| } |