mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -05:00
Prettify existing code
This commit is contained in:
parent
5dbeda43ad
commit
6d297ce935
2 changed files with 21 additions and 21 deletions
13
index.ts
13
index.ts
|
@ -26,25 +26,28 @@ import "reflect-metadata"
|
|||
export class Foo {
|
||||
@printMeta
|
||||
@logArgs
|
||||
typed(a: number, b: "foo", c, d: {a: "foo"|"bar"}, ...e: string[]) {
|
||||
typed(a: number, b: "foo", c, d: { a: "foo" | "bar" }, ...e: string[]) {
|
||||
return a
|
||||
}
|
||||
}
|
||||
|
||||
function logArgs(t, n, pd) {
|
||||
const orig = pd.value
|
||||
pd.value = (...args) => {console.log(orig, ...args); return orig(...args)}
|
||||
pd.value = (...args) => {
|
||||
console.log(orig, ...args)
|
||||
return orig(...args)
|
||||
}
|
||||
}
|
||||
|
||||
function printMeta(target, name, propDesc) {
|
||||
["design:type", "design:paramtypes", "design:returntype"].forEach(key =>
|
||||
console.log(key, Reflect.getMetadata(key, target, name)))
|
||||
;["design:type", "design:paramtypes", "design:returntype"].forEach(key =>
|
||||
console.log(key, Reflect.getMetadata(key, target, name)),
|
||||
)
|
||||
}
|
||||
|
||||
;(window as any).Foo = Foo
|
||||
|
||||
import * as csp from "csp-serdes"
|
||||
|
||||
;(window as any).csp = csp
|
||||
|
||||
// class Excmds {
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
|
||||
class ExCmds {
|
||||
@content
|
||||
scrollline([x],{},meta) {
|
||||
scrollline([x], {}, meta) {
|
||||
// whatever
|
||||
excmd([3, x],null,meta)
|
||||
excmd([3, x], null, meta)
|
||||
parser(`excmd 3 ${x}`, meta)
|
||||
}
|
||||
|
||||
@content
|
||||
scrollline([x],{flags: {down}, meta}) {
|
||||
scrollline([x], { flags: { down }, meta }) {
|
||||
// whatever
|
||||
excmd([3, x],{meta})
|
||||
excmd([3, x], { meta })
|
||||
parser(`excmd 3 ${x}`, meta)
|
||||
}
|
||||
|
||||
|
@ -23,19 +23,18 @@ class ExCmds {
|
|||
* @param blah is x
|
||||
*/
|
||||
@content
|
||||
scrollline({msg}, [x, y], {down, up}) {
|
||||
this.excmd({msg: meta.msg}, 3, x)
|
||||
scrollline({ msg }, [x, y], { down, up }) {
|
||||
this.excmd({ msg: meta.msg }, 3, x)
|
||||
parser(`excmd 3 ${x}`, meta)
|
||||
}
|
||||
|
||||
scrolline({msg, flags: {up, down}}, x, y) {
|
||||
}
|
||||
scrolline({ msg, flags: { up, down } }, x, y) {}
|
||||
|
||||
@content
|
||||
async open({msg, flags}, ...urlarr: string[]) {
|
||||
async open({ msg, flags }, ...urlarr: string[]) {
|
||||
let url = urlarr.join(" ")
|
||||
if (url === "about:blank") {
|
||||
browserBg.tabs.update(msg.tabId, {url})
|
||||
browserBg.tabs.update(msg.tabId, { url })
|
||||
} else if (about_whitelist) {
|
||||
natmsg.open(url)
|
||||
} else if (url) {
|
||||
|
@ -51,13 +50,11 @@ class native {
|
|||
}
|
||||
|
||||
@background
|
||||
print([a, b], meta) {
|
||||
}
|
||||
print([a, b], meta) {}
|
||||
|
||||
path(meta, x, ...y) {
|
||||
}
|
||||
path(meta, x, ...y) {}
|
||||
|
||||
path({msg, flags: {force}}, x, ...y) {
|
||||
foo({msg}, y[0], x)
|
||||
path({ msg, flags: { force } }, x, ...y) {
|
||||
foo({ msg }, y[0], x)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue