Commit 5f7e628c authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Add type for genomeBrowserData layout callbacks

parent 516db5ff
Pipeline #12133 passed with stage
in 56 seconds
import { GenomeBrowserState, GeneData, GenomeBrowserData } from "../types"; import {
GenomeBrowserState,
GeneData,
GenomeBrowserData
} from "../types";
import { format as d3Format } from "d3-format"; import { format as d3Format } from "d3-format";
import { scaleOrdinal } from "d3-scale"; import { scaleOrdinal } from "d3-scale";
import { color } from "d3"; import { color } from "d3";
...@@ -11,8 +15,8 @@ const geneColor = scaleOrdinal( ...@@ -11,8 +15,8 @@ const geneColor = scaleOrdinal(
); );
export default function genomeBrowserData( export default function genomeBrowserData(
state: GenomeBrowserState, state: GenomeBrowserState,
brushHandler: any, brushHandler: (scale: any, state: GenomeBrowserState) => void,
clickHandler: any clickHandler: (geneLocation: [number, number], state: GenomeBrowserState) => void
): GenomeBrowserData { ): GenomeBrowserData {
const { const {
window, window,
......
import GenomeBrowser from "../src/scripts/component/genome-browser"; import GenomeBrowser from "../src/scripts/component/genome-browser";
import genomeBrowserDataLayout from "../src/scripts/layout/genome-browser"; import genomeBrowserDataLayout from "../src/scripts/layout/genome-browser";
import { GenomeBrowserData, GeneData } from "../src/scripts/types"; import { GenomeBrowserData, GeneData, GenomeBrowserState } from "../src/scripts/types";
import { select } from "d3-selection"; import { select } from "d3-selection";
describe("Test Genome Browser", () => { describe("Test Genome Browser", () => {
...@@ -47,10 +47,11 @@ describe("Test Genome Browser", () => { ...@@ -47,10 +47,11 @@ describe("Test Genome Browser", () => {
} }
} }
const genomeBrowserData = genomeBrowserDataLayout( const genomeBrowserData = genomeBrowserDataLayout(
genomeBrowserState, genomeBrowserState,
() => console.log("brush"), (scale, state: GenomeBrowserState) => console.log(scale),
() => console.log("click") (geneLocation, state: GenomeBrowserState) => console.log(geneLocation)
); );
const data: GenomeBrowserData[] = [genomeBrowserData]; const data: GenomeBrowserData[] = [genomeBrowserData];
document.body.innerHTML = document.body.innerHTML =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment