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
| import { LitElement, html } from 'lit'; | |
| import { state } from '../../worker/index.js'; | |
| export class Page extends LitElement { | |
| connectedCallback () { | |
| super.connectedCallback(); | |
| this.logout(); | |
| } | |
| async logout () { |
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
| import { LitElement, html } from 'lit'; | |
| import { state } from '../../worker/index.js'; | |
| export class Page extends LitElement { | |
| async login (event) { | |
| event.preventDefault(); | |
| const { target: form } = event; | |
| const username = form.username.value; |
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
| import { expose } from 'comlink'; | |
| const store = { | |
| // stores data in memory here | |
| data: {}, | |
| // stores all functions that will be called when a data has been updated | |
| fns: {}, | |
| set: async function (key, value) { | |
| // stores the data here |
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
| import { wrap } from 'comlink'; | |
| import Worker from './index.worker.js'; | |
| export const worker = new Worker(); | |
| export const state = wrap(worker); |
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
| import { LitElement, html } from 'lit'; | |
| export class Component extends LitElement { | |
| static properties = { | |
| isLoggedIn: { | |
| type: Boolean | |
| } | |
| } | |
| constructor () { |
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
| import { LitElement, html } from 'lit'; | |
| export class Page extends LitElement { | |
| static properties = { | |
| blog: { | |
| type: Object | |
| } | |
| } | |
| async connectedCallback () { |
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
| import { LitElement, html } from 'lit'; | |
| export class Page extends LitElement { | |
| static properties = { | |
| blogs: { | |
| type: Array | |
| } | |
| } | |
| constructor () { |
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
| import { html } from 'lit'; | |
| import '@tjmonsi/small-router/small-router.js'; | |
| const el = document.querySelector('small-router'); | |
| if (el) { | |
| el.routes = { | |
| '/': { | |
| render: () => html`<home-page></home-page>`, | |
| preRender: () => import('./pages/home/index.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
| import { LitElement, html } from 'lit'; | |
| export class Page extends LitElement { | |
| createRenderRoot () { | |
| // this adds it to the main HTML DOM instead of the shadowDOM | |
| return this; | |
| } | |
| render () { | |
| return html`hello home page` |
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
| import { html } from 'lit'; | |
| import '@tjmonsi/small-router/small-router.js'; | |
| const el = document.querySelector('small-router'); | |
| if (el) { | |
| el.routes = { | |
| '/': { | |
| render: () => html`Hello world` | |
| } |