We're creating a Chrome Extension community report using data from Stack Overflow and Google Groups!
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Firebase Persistent Auth Example</title> | |
</head> | |
<body> | |
<h1 id="authState">Checking auth state...</h1> |
import react from '@vitejs/plugin-react' | |
import type { RPCEPlugin } from 'rollup-plugin-chrome-extension' | |
import type { | |
HmrOptions, | |
PluginOption, | |
ViteDevServer, | |
} from 'vite' | |
export default function createPlugins( | |
...args: Parameters<typeof react> |
const service = interpret(someMachine); | |
debugHelper(service, (state, ids, actors) => { | |
// debug here, this will run on all actors | |
console.log(state, ids); | |
}); |
{ | |
"background": { | |
"service_worker": "service_worker.ts" | |
}, | |
"content_scripts": [ | |
{ | |
"js": ["content.ts"], | |
"matches": ["https://www.google.com/*"] | |
} | |
], |
module.exports = { | |
root: true, | |
parser: '@typescript-eslint/parser', | |
extends: [ | |
'eslint:recommended', | |
'plugin:@typescript-eslint/recommended', | |
], | |
plugins: ['svelte3', '@typescript-eslint'], | |
ignorePatterns: ['*.cjs'], | |
overrides: [ |
type WithTabWithId<Type> = Required< | |
{ | |
[Property in keyof Type]: Type[Property] extends { id?: number } | |
? Type[Property] & { id: number } | |
: Type[Property] | |
} | |
> | |
const isWithTabWithId = <T>(args: T): args is WithTabWithId<T> => { | |
if (!Array.isArray(args)) return false | |
const tab = args.find( |
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
An invariant is more "conceptual" than a variable. In general, it's a property of the program state that is always true. A function or method that ensures that the invariant holds is said to maintain the invariant.
For instance, a binary search tree might have the invariant that for every node, the key of the node's left child is less than the node's own key. A correctly written insertion function for this tree will maintain that invariant.
As you can tell, that's not the sort of thing you can store in a variable: it's more a statement about the program. By figuring out what sort of invariants your program should maintain, then reviewing your code to make sure that it actually maintains those invariants, you can avoid logical errors in your code.
import { writeText } from "./writeText"; | |
import { notify } from "@extend-chrome/notify"; | |
export const notifyCopy = (txt) => { | |
const btnTitle = "copy again"; | |
return notify.create({ | |
message: `"${txt}" was copied to the clipboard.`, | |
buttons: [{ title: btnTitle, onClick: () => writeText(txt) }], | |
}); | |
}; |