type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
async () => { if (db) await db.close(); await testFS.remove(); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.close(); await expect(db.exportJson(jsonFilenameFull)).toReject(); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.exportJson(jsonFilenameFull); await expect(fs.readFile(jsonFilenameFull, "utf8")).resolves.toBe( `{"key1":1,"key2":"2"}\n`, ); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.exportJson(jsonFilenameFull, { spaces: "\t" }); await expect(fs.readFile(jsonFilenameFull, "utf8")).resolves.toBe( `{ "key1": 1, "key2": "2" }\n`, ); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
() => { const testFilename = "close.jsonl"; let testFilenameFull: string; // The basic functionality is tested in the other suites let db: JsonlDB; let testFS: TestFS; let testFSRoot: string; beforeEach(async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull =...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.close(); await db.close(); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.close(); expect(db.isOpen).toBeFalse(); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
() => { const testFilename = "dump.jsonl"; let testFilenameFull: string; let db: JsonlDB; let dumpdb: JsonlDB; let testFS: TestFS; let testFSRoot: string; beforeEach(async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename);...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await testFS.create({ [testFilename]: "", [testFilename + ".dump"]: "", }); db = new JsonlDB(testFilenameFull); dumpdb = new JsonlDB(testFilenameFull + ".dump")...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.close(); await dumpdb.close(); await testFS.remove(); mockAppendFileThrottle = 0; }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { for (let i = 1; i < 20; i++) { if (i % 4 === 0) { db.delete(`${i - 1}`); } else { db.set(`${i}`, i); } } await db.dump(); await dumpdb.close(); await dumpdb.open(); assertEqual(db, dumpdb); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { // simulate a slow FS mockAppendFileThrottle = 50; let dumpPromise: Promise<void>; for (let i = 1; i < 20; i++) { if (i % 4 === 0) { db.delete(`${i - 1}`); } else { db.set(`${i}`, i); } if (i === 10) dumpPromise = db.dump(); if (i > 10) await wait(20); } aw...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { for (let i = 1; i < 20; i++) { if (i % 4 === 0) { db.delete(`${i - 1}`); } else { db.set(`${i}`, i); } } // simulate a slow FS mockAppendFileThrottle = 50; // dump without waiting db.dump(); // wait a bit, so the files are being opened await wait(100); //...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
() => { const testFilename = "compress.jsonl"; let testFilenameFull: string; let db: JsonlDB; let testFS: TestFS; let testFSRoot: string; beforeEach(async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await testFS.cr...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.close(); await testFS.remove(); mockMoveFileThrottle = 0; mockAppendFileThrottle = 0; }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { db.set("key3", 3); db.delete("key2"); db.set("key3", 3.5); await db.compress(); await expect(fs.readFile(testFilenameFull, "utf8")).resolves.toBe( '{"k":"key1","v":1}\n{"k":"key3","v":3.5}\n', ); await expect( fs.pathExists(testFilenameFull + ".dump"), ).resolves.toBeFals...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { db.set("key3", 3); db.delete("key2"); db.set("key3", 3.5); await db.compress(); db.set("key2", 1); // Force flush await db.close(); await expect(fs.readFile(testFilenameFull, "utf8")).resolves.toBe( '{"k":"key1","v":1}\n{"k":"key3","v":3.5}\n{"k":"key2","v":1}\n', ); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { db.set("key3", 3); db.delete("key2"); db.set("key3", 3.5); const closePromise = db.close(); await db.compress(); await closePromise; await expect(fs.readFile(testFilenameFull, "utf8")).resolves.toBe( '{"k":"key1","v":1}\n{"k":"key2","v":"2"}\n{"k":"key3","v":3}\n{"k":"key2"}\n{"...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { db.set("key3", 3); db.delete("key2"); db.set("key3", 3.5); // simulate slow FS mockMoveFileThrottle = 10; mockAppendFileThrottle = 10; const compressPromise = db.compress(); await db.compress(); await compressPromise; await expect(fs.readFile(testFilenameFull, "utf8")).re...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { // simulate a slow FS mockMoveFileThrottle = 50; let compressPromise: Promise<void>; const map = new Map<any, any>([ ["key1", 1], ["key2", "2"], ]); for (let i = 1; i < 20; i++) { if (i % 4 === 0) { db.delete(`${i - 1}`); map.delete(`${i - 1}`); } else { d...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { // simulate a slow FS mockMoveFileThrottle = 50; const map = new Map<any, any>([ ["key1", 1], ["key2", "2"], ]); for (let i = 1; i < 20; i++) { if (i % 4 === 0) { db.delete(`${i - 1}`); map.delete(`${i - 1}`); } else { db.set(`${i}`, i); map.set(`${i}`, ...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
() => { const testFilename = "compress-with-bak.jsonl"; let testFilenameFull: string; let db: JsonlDB; let testFS: TestFS; let testFSRoot: string; beforeEach(async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await ...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await testFS.create({ [testFilename]: '{"k":"key1","v":1}\n{"k":"key2","v":"2"}\n', [`${testFilename}.bak`]: '{"k":"key1","v":1}\n{"k":"key2","v":"2"}\n', }); ...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.compress(); await db.close(); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
() => { const testFilename = "uncompressedSize.jsonl"; let testFilenameFull: string; let db: JsonlDB; let testFS: TestFS; let testFSRoot: string; beforeEach(async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await t...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await testFS.create({ [testFilename]: ` {"k":"key1","v":1} {"k":"key2","v":"2"} {"k":"key1"} {"k":"key2"} {"k":"key2","v":"2"} {"k":"key3","v":3} {"k":"key3"} `, }); d...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.close(); await testFS.remove(); mockMoveFileThrottle = 0; }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.close(); expect(() => db.uncompressedSize).toThrowError("not open"); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
() => db.uncompressedSize
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { expect(db.uncompressedSize).toBe(7); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { db.set("key4", 1); expect(db.uncompressedSize).toBe(8); db.set("key4", 1); expect(db.uncompressedSize).toBe(9); db.set("key4", 1); expect(db.uncompressedSize).toBe(10); db.set("key5", 2); expect(db.uncompressedSize).toBe(11); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { db.delete("key4"); expect(db.uncompressedSize).toBe(7); db.delete("key2"); expect(db.uncompressedSize).toBe(8); db.delete("key2"); expect(db.uncompressedSize).toBe(8); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { db.clear(); expect(db.uncompressedSize).toBe(0); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.compress(); expect(db.uncompressedSize).toBe(1); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { // simulate a slow FS mockMoveFileThrottle = 50; const compressPromise = db.compress(); await wait(20); db.set("key1", "value1"); await compressPromise; expect(db.uncompressedSize).toBe(2); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
() => { const testFilename = "autoCompress.jsonl"; let testFilenameFull: string; const uncompressed = ` {"k":"key1","v":1} {"k":"key2","v":"2"} {"k":"key3","v":3} {"k":"key2"} {"k":"key3","v":3.5}`; let db: JsonlDB; let testFS: TestFS; let testFSRoot: string; beforeEach(async () => { testFS = new Te...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await testFS.create({ [testFilename]: `{"k":"key1","v":1}`, openClose: uncompressed, }); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await db.close(); await testFS.remove(); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { db = new JsonlDB(testFilenameFull, { autoCompress: { sizeFactor: 4, }, }); const compressSpy = jest.spyOn(db, "compress"); await db.open(); for (let i = 2; i <= 9; i++) { db.set("key1", i); // compress is async, so give it some time await wait(20); if (i <= 3)...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { db = new JsonlDB(testFilenameFull, { autoCompress: { sizeFactor: 4, sizeFactorMinimumSize: 20, }, }); const compressSpy = jest.spyOn(db, "compress"); await db.open(); for (let i = 2; i <= 20; i++) { db.set("key1", i); // compress is async, so give it some time ...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { db = new JsonlDB(testFilenameFull, { autoCompress: { sizeFactor: 4, }, }); const compressSpy = jest.spyOn(db, "compress"); await db.open(); for (let i = 2; i <= 20; i++) { db.set("key" + i, i); } await db.close(); expect(compressSpy).not.toBeCalled(); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { jest.retryTimes(3); // timeout-based tests are flaky. retry to be sure db = new JsonlDB(testFilenameFull, { autoCompress: { intervalMs: 100, }, }); const compressSpy = jest.spyOn(db, "compress"); await db.open(); for (let i = 1; i <= 3; i++) { // Don't test too often,...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { db = new JsonlDB(testFilenameFull, { autoCompress: { intervalMs: 100, intervalMinChanges: 2, }, }); const compressSpy = jest.spyOn(db, "compress"); await db.open(); await wait(100); expect(compressSpy).not.toBeCalled(); db.set("key1", 1); await wait(100); ex...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { const testFilenameFull = path.join(testFSRoot, "openClose"); db = new JsonlDB(testFilenameFull, { autoCompress: { onOpen: true, }, }); // Cannot use this, since open calls compressInternal // expect(compressSpy).toBeCalledTimes(1); await db.open(); await expect(fs.readF...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { const testFilenameFull = path.join(testFSRoot, "openClose"); db = new JsonlDB(testFilenameFull, { autoCompress: { onClose: true, }, }); // Cannot use this, since close calls compressInternal // expect(compressSpy).toBeCalledTimes(1); await db.open(); await expect(fs.read...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
() => { const testFilename = "throttled.jsonl"; let testFilenameFull: string; let db: JsonlDB; let testFS: TestFS; let testFSRoot: string; beforeEach(async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await testFS.c...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await testFS.create({ [testFilename]: ``, }); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { jest.retryTimes(3); // timeout-based tests are flaky. retry to be sure db = new JsonlDB(testFilenameFull, { throttleFS: { intervalMs: 100, }, }); await db.open(); // Trigger at least one scheduled cork before the first write await wait(110); await assertFileContent("")...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { jest.retryTimes(3); // timeout-based tests are flaky. retry to be sure db = new JsonlDB(testFilenameFull, { throttleFS: { intervalMs: 100, maxBufferedCommands: 5, }, }); await db.open(); db.set("1", 1); let expected = `{"k":"1","v":1}\n`; await assertFileContent("...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { jest.retryTimes(3); // timeout-based tests are flaky. retry to be sure db = new JsonlDB(testFilenameFull, { throttleFS: { intervalMs: 100, }, }); await db.open(); await db.compress(); db.set("1", 1); let expected = `{"k":"1","v":1}\n`; await assertFileContent(""); ...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { jest.retryTimes(3); // timeout-based tests are flaky. retry to be sure db = new JsonlDB(testFilenameFull, { throttleFS: { intervalMs: 100, }, }); await db.open(); db.set("1", 1); let expected = `{"k":"1","v":1}\n`; await assertFileContent(""); await wait(50); fo...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
() => { const testFilename = "checks.jsonl"; let testFilenameFull: string; let db: JsonlDB; let testFS: TestFS; let testFSRoot: string; beforeEach(async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await testFS.crea...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { const expected = [ /* 0: */ { key: "foobar", value: new Date().toISOString() }, /* 1: */ { key: "asdfasg", value: true }, /* 2: */ { key: 'x"blub', value: { lets: "get", complicated: { "!": "?" } }, }, /* 3: */ { key: "sssssss", value: null }, /* 4: */ { key: "1", val...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
(e) => e.key
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
(e) => e.value
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
(e) => [e.key, e.value]
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
() => { const testFilename = "serializer.jsonl"; let testFilenameFull: string; let db: JsonlDB; let testFS: TestFS; let testFSRoot: string; beforeEach(async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await testFS....
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); await testFS.create(); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { const serializer = jest.fn().mockReturnValue("ffff"); db = new JsonlDB(testFilenameFull, { serializer }); await db.open(); const map = new Map<any, any>([ [1, "foo"], [2, "bar"], ]); db.set("test", map); await db.close(); await wait(10); await expect(fs.readFile(test...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
() => { let testFS: TestFS; let testFSRoot: string; let db: JsonlDB; const testFilename = "recovery.jsonl"; let testFilenameFull: string; beforeEach(async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); }); afterEach...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { testFS = new TestFS(); testFSRoot = await testFS.getRoot(); testFilenameFull = path.join(testFSRoot, testFilename); }
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await testFS.create({ // Original, uncompressed db in the .bak file [testFilename + ".bak"]: ` {"k":"key1","v":1} {"k":"key2","v":"2"} {"k":"key3","v":3} {"k":"key2"} {"k":"key3","v":3.5}`, // empty, broken db file [testFilename]: "", // (probably) half-complete .dump file [tes...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await testFS.create({ // Original, uncompressed db in the .bak file [testFilename + ".bak"]: ` {"k":"key1","v":1} {"k":"key2","v":"2"} {"k":"key3","v":3} {"k":"key2"} {"k":"key3","v":3.5}`, // (probably) half-complete .dump file [testFilename + ".dump"]: ` {"k":"key1","v":1} {"k":"key3...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await testFS.create({ // empty, broken .bak file [testFilename + ".bak"]: "", // empty, broken db file [testFilename]: "", // (probably) half-complete .dump file, but better than nothing [testFilename + ".dump"]: ` {"k":"key1","v":1} {"k":"key3","v":3}`, }); const db = n...
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ArrowFunction
async () => { await testFS.create({ // empty, broken db file [testFilename]: "", // (probably) half-complete .dump file, but better than nothing [testFilename + ".dump"]: ` {"k":"key1","v":1} {"k":"key3","v":3}`, }); const db = new JsonlDB(testFilenameFull); await db.open(); expect(db....
AlCalzone/jsonl-db
src/lib/db.test.ts
TypeScript
ClassDeclaration
/** * <p>Stops the specified human loop.</p> * @example * Use a bare-bones client and the command you need to make an API call. * ```javascript * import { SageMakerA2IRuntimeClient, StopHumanLoopCommand } from "@aws-sdk/client-sagemaker-a2i-runtime"; // ES Modules import * // const { SageMakerA2IRuntimeClient, St...
AllanFly120/aws-sdk-js-v3
clients/client-sagemaker-a2i-runtime/src/commands/StopHumanLoopCommand.ts
TypeScript
InterfaceDeclaration
export interface StopHumanLoopCommandInput extends StopHumanLoopRequest {}
AllanFly120/aws-sdk-js-v3
clients/client-sagemaker-a2i-runtime/src/commands/StopHumanLoopCommand.ts
TypeScript
InterfaceDeclaration
export interface StopHumanLoopCommandOutput extends StopHumanLoopResponse, __MetadataBearer {}
AllanFly120/aws-sdk-js-v3
clients/client-sagemaker-a2i-runtime/src/commands/StopHumanLoopCommand.ts
TypeScript
MethodDeclaration
/** * @internal */ resolveMiddleware( clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: SageMakerA2IRuntimeClientResolvedConfig, options?: __HttpHandlerOptions ): Handler<StopHumanLoopCommandInput, StopHumanLoopCommandOutput> { this.middlewareStack.use(getSerdeP...
AllanFly120/aws-sdk-js-v3
clients/client-sagemaker-a2i-runtime/src/commands/StopHumanLoopCommand.ts
TypeScript
MethodDeclaration
private serialize(input: StopHumanLoopCommandInput, context: __SerdeContext): Promise<__HttpRequest> { return serializeAws_restJson1StopHumanLoopCommand(input, context); }
AllanFly120/aws-sdk-js-v3
clients/client-sagemaker-a2i-runtime/src/commands/StopHumanLoopCommand.ts
TypeScript
MethodDeclaration
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<StopHumanLoopCommandOutput> { return deserializeAws_restJson1StopHumanLoopCommand(output, context); }
AllanFly120/aws-sdk-js-v3
clients/client-sagemaker-a2i-runtime/src/commands/StopHumanLoopCommand.ts
TypeScript
ArrowFunction
() => { test("File Change Event (simple)", function() { let origEvent: any = {}; let oldValue: any = { foo: "bar" }; let newValue: any = { foo: "foo" }; let event = new LocalFileChangeEvent(oldValue, newValue, origEvent); assert.strictEqual(event.originalEvent, origEvent); assert.strictEqual(event.oldVa...
07026657836/vscode
src/vs/workbench/parts/files/test/browser/events.test.ts
TypeScript
ClassDeclaration
@polyfill export class NonIdealState extends AbstractPureComponent2<INonIdealStateProps> { public static displayName = `${DISPLAYNAME_PREFIX}.NonIdealState`; public render() { const { action, children, className, description, title } = this.props; return ( <div className={className...
AaronJRubin/blueprint
packages/core/src/components/non-ideal-state/nonIdealState.tsx
TypeScript
InterfaceDeclaration
export interface INonIdealStateProps extends IProps { /** An action to resolve the non-ideal state which appears after `description`. */ action?: JSX.Element; /** * Advanced usage: React `children` will appear last (after `action`). * Avoid passing raw strings as they will not receive margins an...
AaronJRubin/blueprint
packages/core/src/components/non-ideal-state/nonIdealState.tsx
TypeScript
MethodDeclaration
public render() { const { action, children, className, description, title } = this.props; return ( <div className={classNames(Classes.NON_IDEAL_STATE, className)}> {this.maybeRenderVisual()} {title && <H4>{title}</H4>} {description && ensureEl...
AaronJRubin/blueprint
packages/core/src/components/non-ideal-state/nonIdealState.tsx
TypeScript
MethodDeclaration
private maybeRenderVisual() { const { icon } = this.props; if (icon == null) { return null; } else { return ( <div className={Classes.NON_IDEAL_STATE_VISUAL}> <Icon icon={icon} iconSize={Icon.SIZE_LARGE * 3} /> </div> ...
AaronJRubin/blueprint
packages/core/src/components/non-ideal-state/nonIdealState.tsx
TypeScript
FunctionDeclaration
export function onNavigatingTo(args: NavigatedData) { const page = <Page>args.object; page.bindingContext = new SearchViewModel(); }
NathanaelA/nativescript-app-templates
packages/template-drawer-navigation-ts/app/search/search-page.ts
TypeScript
FunctionDeclaration
export function onDrawerButtonTap(args: EventData) { const sideDrawer = <RadSideDrawer>app.getRootView(); sideDrawer.showDrawer(); }
NathanaelA/nativescript-app-templates
packages/template-drawer-navigation-ts/app/search/search-page.ts
TypeScript
ArrowFunction
(): ThemePreference => { const value = localStorage.getItem(LIGHT_THEME_LOCAL_STORAGE_KEY) // Handle both old and new preference values switch (value) { case 'true': case 'light': return ThemePreference.Light case 'false': case 'dark': return ThemePre...
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
location => getModeFromPath(location.pathname)
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
([extensions, languageID]) => { preloadExtensions({ extensions, languages: new Set([languageID]), }) }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
([settingsCascade, authenticatedUser]) => { this.setState(state => ({ settingsCascade, authenticatedUser, ...experimentalFeaturesFromSettings(settingsCascade), globbing: globbingEnabledFromSettings(setti...
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
state => ({ settingsCascade, authenticatedUser, ...experimentalFeaturesFromSettings(settingsCascade), globbing: globbingEnabledFromSettings(settingsCascade), searchCaseSensitivity: ...
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
() => this.setState({ authenticatedUser: null })
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
([[oldSettings], [newSettings, authUser]]) => { if (authUser) { logInsightMetrics(oldSettings, newSettings, eventLogger) } }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
event => { this.setState({ systemIsLightTheme: !event.matches }) }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
([, authenticatedUser]) => authenticatedUser ? combineLatest([ listUserRepositories({ id: authenticatedUser.id, first: 1 }), queryExternalServices({ namespace: authenticatedUser.id, first: 1, after: ...
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
error => [asError(error)]
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
result => { if (!isErrorLike(result) && result !== null) { const [userRepositoriesResult, externalServicesResult] = result this.setState({ hasUserAddedRepositories: userRepositoriesResult.nodes.length > 0, ...
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
authenticatedUser => authenticatedUser ? fromEvent<ErrorEvent>(window, 'error') : of(null)
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
event => { if (event?.error instanceof HTTPStatusError && event.error.status === 401) { location.reload() } }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
event => { // Disabling linter here because this is not yet used anywhere. // This can be re-enabled as soon as feature flags are leveraged. // eslint-disable-next-line react/no-unused-state this.setState({ featureFlags: event }) }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
error => { console.error('Error sending initial version context to extensions', error) }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
error => { console.error('Error sending search context to extensions', error) }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
(themePreference: ThemePreference): void => { this.setState({ themePreference }) }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
(navbarSearchQueryState: QueryState): void => { this.setState({ navbarSearchQueryState }) }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
(query: string): void => { this.setState({ parsedSearchQuery: query }) }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
(patternType: SearchPatternType): void => { this.setState({ searchPatternType: patternType, }) }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
(caseSensitive: boolean): void => { this.setState({ searchCaseSensitivity: caseSensitive, }) }
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript
ArrowFunction
async (versionContext: string | undefined): Promise<void> => { const resolvedVersionContext = resolveVersionContext(versionContext, this.state.availableVersionContexts) if (!resolvedVersionContext) { localStorage.removeItem(LAST_VERSION_CONTEXT_KEY) this.setState({ versionContex...
orijtech/sourcegraph
client/web/src/SourcegraphWebApp.tsx
TypeScript