This is illustrating issue with vscode
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
class Model { | |
constructor(isShiftPressed=false, marker=null, selection=null) { | |
this.isShiftPressed = isShiftPressed | |
this.marker = marker | |
this.selection = selection | |
this.tasks = [] | |
} | |
clone() { | |
const instance = new this.constructor() | |
Object.keys(this).forEach(key => instance[key] = this[key]) |
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
/** | |
* @template T, X, A | |
* @typedef {import('./protocol').Process<T, X, A>} Process | |
*/ | |
/** | |
* @template X, T | |
* @typedef {import('./protocol').Task<X, T>} Task | |
*/ |
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
interface CID { | |
code: number | |
version: number | |
multihash: Uint8Array | |
bytes: Uint8Array | |
} | |
type Future<T> = | |
| T | |
| Promise<T> |
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
use async_std::task; | |
use juniper::{EmptyMutation, RootNode}; | |
struct Concrete; | |
enum CustomName { | |
Concrete(Concrete), | |
} | |
#[juniper::graphql_object] |
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
type Tag { | |
id:ID | |
name: String! @fake(type:word) | |
} | |
type InlineLink { | |
id:ID | |
to:Resource! | |
name:String @examples(values: ["automerge", "pushpin", "local-first", "farm"]) | |
description:String @fake(type:words) |
[Flow][] static type checker is a wonderful attempt to bring [algebric data types][] to JS. It is still fairly new project and there for has few WTFs that can pull you down the rabbit hole. This document is attempt to document things that may seem like a WTF from the perspective of JS developer who tries to employ static type checker, or in other words, some items on the list may be very subjective & based on the background of the writer.
It is very likely that one will wind up using [Polymorphic functions][] to solve a more general problem. And if you define type alias for such a function you may be puzzled what is the right syntax should be used for such type definition.
Let's start with:
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
type DocID<a> = string | |
type Doc<a> = a | |
interface RepoService { | |
keys: KeyService | |
create<a>(doc: Doc<a>): Promise<DocID<a>> | |
read<a>(id: DocID<a>): Promise<a> | |
change<a>(id: DocID<a>, change: (doc: a) => void): Promise<void> | |
watch<a>(id: DocID<a>): AsyncIterator<a> |
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.prototype.runOnBackgroundThread = function (aCallback) { | |
var _blob = new Blob(['onmessage = '+this.toString()],{"type":"text/javascript"}); | |
var _worker = new Worker((webkitURL.createObjectURL || URL.createObjectURL)(_blob)); | |
_worker.onmessage = aCallback; | |
_worker.postMessage(); | |
} | |
var _test = function () { | |
postMessage((1+1).toString()); | |
} |
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
// Security Error: Content at about:srcdoc may not load or link to resource://jid1-pss5nuwzdn1n3a-at-jetpack/signals/data/index.html. | |
let XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; | |
let HTML_NS = "http://www.w3.org/1999/xhtml"; | |
let toolbar = document.createElementNS(XUL_NS, "toolbar"); | |
toolbar.setAttribute("collapsed", false); | |
toolbar.setAttribute("style", "height: 80px;"); | |
let toolbox = document.getElementById("navigator-toolbox"); |