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
/** | |
* Preloads the image, and invokes the callback as soon | |
* as the image is loaded. | |
*/ | |
var preload = function(src, callback) { | |
// Create a temporary image. | |
var img = new Image(); | |
// Invoke the callback as soon as the image is loaded | |
// Has to be set **before** the .src attribute. Otherwise |
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
import HeaderMenu from './lib/components/HeaderMenu.svelte' | |
import type { SvelteComponent } from 'svelte' | |
customElements.define( | |
// I recommend prefixing your custom elements, but for this example | |
// I'm keeping it simple. | |
'header-menu', | |
class extends HTMLElement { | |
_element: SvelteComponent; | |
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
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) { | |
/******/ return installedModules[moduleId].exports; |
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
/** | |
* Implements the EventTarget, but with type safety. | |
* | |
* Extend this class with an object that describes your events like this: | |
* | |
* type AccountEvents = { | |
* logout: null | |
* 'sign-in': { username: string; password: string } | |
* } | |
* class Account extends TypedEventTarget<AccountEvents> { |
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
import commonjs from '@rollup/plugin-commonjs' | |
import resolve from '@rollup/plugin-node-resolve' | |
import typescript from '@rollup/plugin-typescript' | |
import svelte from 'rollup-plugin-svelte' | |
import { terser } from 'rollup-plugin-terser' | |
import sveltePreprocess from 'svelte-preprocess' | |
const production = !process.env.ROLLUP_WATCH | |
export default { |
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
<!-- HTML heavily inspired by http://blueimp.github.io/jQuery-File-Upload/ --> | |
<div class="table table-striped" class="files" id="previews"> | |
<div id="template" class="file-row"> | |
<!-- This is used as the file preview template --> | |
<div> | |
<span class="preview"><img data-dz-thumbnail /></span> | |
</div> | |
<div> | |
<p class="name" data-dz-name></p> |
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
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] |
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
jobs: | |
build: | |
# ... | |
test: | |
# ... | |
deploy: | |
# Only run if merged to main. | |
if: github.ref == 'refs/heads/main' | |
# Only deploy if all tests passed. |
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
jobs: | |
build: | |
# We're running on ubuntu-latest, nothing special | |
runs-on: ubuntu-latest | |
steps: | |
# As usual, we simply checkout the project | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# This action is provided by Cypress. It installs node and the NPM |
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
jobs: | |
build: | |
# Everything from the last section | |
test: | |
# We depend on the build step for this. | |
needs: build | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
# We need to use the cypress container here, that includes chrome and |
NewerOlder