These are are some notes I put together on butchering the rectangular dishy cable.
FOLLOW THESE GUIDELINES AT YOUR OWN RISK. I TAKE NO RESPONSIBILITY FOR ANY DAMAGE OR INJURY YOU SUSTAIN FROM FOLLOWING OR NOT FOLLOWING THESE GUIDELINES.
import { html } from 'lit-element'; | |
import { statefulDirective, StatefulLitElement } from './statefulDirective.js'; | |
const simple = statefulDirective((param) => (part) => { | |
console.log("Activate simple", param, part); | |
part.setValue(param); | |
return () => console.log("Remove simple", param, part); | |
}); | |
const withUpdate = statefulDirective((param) => (part) => { |
import {html, TemplateResult} from 'lit-element'; | |
interface CachedNeedlessValue { | |
value: any; | |
index: number; | |
} | |
interface CachedTemplateStrings { | |
strings: string[]; | |
needlessValues: CachedNeedlessValue[]; |
import { html } from 'lit-element'; | |
import { TemplateResult } from 'lit-html'; | |
let str: string; | |
let valuesLength: number; | |
const cacheTemplateStringsToPreparedTemplateStrings = new WeakMap<TemplateStringsArray, string[]>(); | |
const cacheTemplateStringsToNeedlessValuesIndexes = new WeakMap<TemplateStringsArray, number[]>(); | |
// Сonvert dynamic tags to template strings |
export const ws = webSocket<WebsocketMessage>(`wss://${location.hostname}:${location.protocol === 'https:' ? 443 : 80}/ws/`); | |
export const wsObserver = ws | |
.pipe( | |
retryWhen(errors => | |
errors.pipe( | |
delay(1000) | |
) | |
) | |
); |
In a nutshell it is just the following:
interface IDocument { | |
id: number; | |
documents: IDocument[]; | |
} | |
const DOCUMENTS: IDocument[] = [{ | |
id: 100, | |
documents: [ | |
{ | |
id: 1, |
// http://kestas.kuliukas.com/YCombinatorExplained/ | |
// https://rosettacode.org/wiki/Y_combinator#JavaScript | |
// | |
// const factorial = Y(next => (n) => { | |
// if (n < 2) return 1; | |
// return n * next(n - 1); | |
// }); | |
// console.log(factorial(5)); // 120 | |
const Y = f => (...args) => f(Y(f))(...args); |
//a quick example of how to use actual 'if' statements inside template literals, | |
//without using ternary operator. Sometimes this is cleaner if you have complex conditionals or nested conditionals. | |
//data param is passed in via render(template(data), this) - if not using lit-html, could be any function | |
template = (data) => html` | |
<div id="job_edit" class="modal"> | |
<div class="modal-content"> | |
${ | |
//we're just going to wrap an anonymous inline function here and then call it with some data | |
(job => { //job here, is just an example, it could be anything, it's passed in below in (data.job) | |
if(job) |