Best JavaScript code snippet using tracetest
CanvasElement.ts
Source:CanvasElement.ts
1import { HitBox } from '../HitBox';2import { KeyData } from '../interfaces/key-data.interface';3import { Sprite } from '../Sprite';4import { TileMap } from '../TileMap';5import { defaultAttributes } from './default-attributes';6import { GameUIEvent } from './interfaces/game-ui-event.interface';7import { ElementName } from './types/element-name.type';8import { ListenerHandler } from './types/listener-handler.type';9import { ListenerType } from './types/listener.type';10export class CanvasElement {11 private hitBox: HitBox;12 private listeners: Map<ListenerType, ListenerHandler[]> = new Map();13 private attributeList: Map<string, unknown> = defaultAttributes();14 private children: CanvasElement[] = [];15 private _parent: CanvasElement | null = null;16 public id: string | null = null;17 public elementName: ElementName = 'base';18 constructor(19 width: number,20 height: number,21 position: DOMPoint,22 private background: Sprite23 ) {24 this.hitBox = new HitBox(width, height, position, [0, 0], '#043cf3');25 this.background.setDimensions(width, height);26 this.attributeList.set('width', width);27 this.attributeList.set('height', height);28 this.attributeList.set('position', position);29 }30 public draw(ctx: CanvasRenderingContext2D, drawBox = false) {31 if (!this.visible || this.disabled) return;32 if (this.visible && !this.disabled) {33 this.background.draw(ctx, this.position);34 }35 if (this.borderColor && !this.borderImage) {36 const hb = new HitBox(37 this.width,38 this.height,39 this.position,40 [this.padding, this.padding],41 this.borderColor42 );43 hb.draw(ctx);44 }45 if (this.borderImage) {46 this.drawBorderImage(ctx);47 }48 for (const child of this.children) {49 child.draw(ctx, drawBox);50 }51 if (drawBox && !this.disabled) {52 this.hitBox.draw(ctx);53 }54 }55 private drawBorderImage(ctx: CanvasRenderingContext2D) {56 if (!this.borderImage) return;57 const image = this.borderImage;58 if (image.getCount()[0] === 2) {59 this.draw2x2BorderImageMap(ctx, image);60 } else {61 this.draw3x3BorderImageMap(ctx, image);62 }63 }64 private draw2x2BorderImageMap(ctx: CanvasRenderingContext2D, image: TileMap) {65 const tileDim = image.getTileDimensions();66 const height = Math.ceil(this.height / tileDim.height) + 1;67 const width = Math.ceil(this.width / tileDim.width) + 1;68 if (Math.abs(height) === Infinity || Math.abs(width) === Infinity) return;69 const pos = new DOMPoint(70 this.position.x - tileDim.width,71 this.position.y - tileDim.height72 );73 const map = {74 tl: new DOMPoint(0, 0),75 tr: new DOMPoint(2, 0),76 bl: new DOMPoint(0, 2),77 br: new DOMPoint(2, 2)78 };79 for (let y = 0; y < height; y++) {80 const posY = pos.y + y * tileDim.height;81 for (let x = 0; x < width; x++) {82 const posX = pos.x + x * tileDim.width;83 const newPos = new DOMPoint(posX, posY);84 // Corners85 if (x === 0 && y === 0) {86 image.drawTile(ctx, newPos, map.tl);87 } else if (x === width - 1 && y === 0) {88 image.drawTile(ctx, newPos, map.tr);89 } else if (x === 0 && y === height - 1) {90 image.drawTile(ctx, newPos, map.bl);91 } else if (x === width - 1 && y === height - 1) {92 image.drawTile(ctx, newPos, map.br);93 }94 }95 }96 }97 private draw3x3BorderImageMap(ctx: CanvasRenderingContext2D, image: TileMap) {98 const tileDim = image.getTileDimensions();99 const height = Math.ceil(this.height / tileDim.height) + 1;100 const width = Math.ceil(this.width / tileDim.width) + 1;101 if (Math.abs(height) === Infinity || Math.abs(width) === Infinity) return;102 const pos = new DOMPoint(103 this.position.x - tileDim.width,104 this.position.y - tileDim.height105 );106 const map = {107 tl: new DOMPoint(0, 0),108 t: new DOMPoint(1, 0),109 tr: new DOMPoint(2, 0),110 ml: new DOMPoint(0, 1),111 mr: new DOMPoint(2, 1),112 bl: new DOMPoint(0, 2),113 b: new DOMPoint(1, 2),114 br: new DOMPoint(2, 2)115 };116 for (let y = 0; y < height; y++) {117 const posY = pos.y + y * tileDim.height;118 for (let x = 0; x < width; x++) {119 const posX = pos.x + x * tileDim.width;120 const newPos = new DOMPoint(posX, posY);121 // Sides122 if (y === 0 && x < width - 1) {123 image.drawTile(ctx, newPos, map.t);124 } else if (x === 0 && y < height - 1) {125 image.drawTile(ctx, newPos, map.ml);126 } else if (x === width - 1 && y < height - 1 && y > 0) {127 image.drawTile(ctx, newPos, map.mr);128 } else if (x > 0 && x < width - 1 && y === height - 1) {129 image.drawTile(ctx, newPos, map.b);130 }131 // Corners132 if (x === 0 && y === 0) {133 image.drawTile(ctx, newPos, map.tl);134 } else if (x === width - 1 && y === 0) {135 image.drawTile(ctx, newPos, map.tr);136 } else if (x === 0 && y === height - 1) {137 image.drawTile(ctx, newPos, map.bl);138 } else if (x === width - 1 && y === height - 1) {139 image.drawTile(ctx, newPos, map.br);140 }141 }142 }143 }144 public appendChild(child: CanvasElement) {145 if (this.children.includes(child)) return;146 child.parent = this;147 const offset = child.position;148 const selfPos = this.position;149 const pos = new DOMPoint(selfPos.x + offset.x, selfPos.y + offset.y);150 child.position = pos;151 if (this.id !== 'BODY') {152 // Inheritable styles153 child.family = this.family;154 }155 this.children.push(child);156 }157 public removeChild(child: CanvasElement) {158 this.children = this.children.filter((c) => c !== child);159 }160 public hasChild(child: CanvasElement): boolean {161 return this.children.includes(child);162 }163 public findElementById(id: string): CanvasElement | null {164 if (this.id === id) return this;165 let found = this.children.find((el) => el.id === id) || null;166 if (found) return found;167 for (const child of this.children) {168 found = child.findElementById(id);169 if (found) {170 break;171 }172 }173 return found;174 }175 public addEventListener(name: ListenerType, handler: ListenerHandler) {176 const current = this.listeners.get(name);177 if (current) {178 current.push(handler);179 this.listeners.set(name, current);180 } else {181 this.listeners.set(name, [handler]);182 }183 }184 protected fireEvent(name: ListenerType, evt: GameUIEvent) {185 if (186 this.attributeList.has('disabled') &&187 !this.attributeList.get('disabled')!188 ) {189 const handlers = this.listeners.get(name) || [];190 handlers.forEach((h) => h(evt));191 }192 }193 public click(pos: DOMPoint, propagate = true) {194 const enabled =195 this.attributeList.has('disabled') && !this.attributeList.get('disabled');196 if (enabled && this.hitBox.collided(new HitBox(3, 3, pos))) {197 this.fireEvent('ui-click', {198 target: this,199 data: { position: pos, keys: {} }200 });201 if (propagate) {202 for (const child of this.children) {203 child.click(pos);204 }205 }206 }207 }208 public mouseover(pos: DOMPoint, propagate = true) {209 const enabled =210 this.attributeList.has('disabled') && !this.attributeList.get('disabled');211 if (enabled && this.hitBox.collided(new HitBox(3, 3, pos))) {212 this.fireEvent('ui-mouseover', {213 target: this,214 data: { position: pos, keys: {} }215 });216 if (propagate) {217 for (const child of this.children) {218 child.mouseover(pos, true);219 }220 }221 }222 }223 public mouseout(pos: DOMPoint, propagate = true) {224 const enabled =225 this.attributeList.has('disabled') && !this.attributeList.get('disabled');226 if (enabled) {227 if (propagate) {228 for (const child of this.children) {229 child.mouseout(pos, true);230 }231 }232 }233 if (enabled && !this.hitBox.collided(new HitBox(3, 3, pos))) {234 this.fireEvent('ui-mouseout', {235 target: this,236 data: { position: pos, keys: {} }237 });238 }239 }240 public focus(pos: DOMPoint) {241 const enabled =242 this.attributeList.has('disabled') && !this.attributeList.get('disabled');243 const click = new HitBox(3, 3, pos);244 if (enabled && this.hitBox.collided(click)) {245 this.fireEvent('ui-focus', {246 target: this,247 data: { position: pos, keys: {} }248 });249 for (const child of this.children) {250 child.mouseover(pos);251 }252 let childCollisions = this.children.map((child) =>253 child.hitBox.collided(click)254 );255 childCollisions = childCollisions.length > 0 ? childCollisions : [false];256 const collidedWithChild = childCollisions.reduce(257 (acc, cur) => acc && cur,258 true259 );260 if (collidedWithChild) {261 this.setAttribute('focus', false);262 } else {263 this.setAttribute('focus', true);264 }265 }266 }267 public keydown(keys: Record<string, KeyData>) {268 const enabled =269 this.attributeList.has('disabled') && !this.attributeList.get('disabled');270 if (enabled) {271 this.fireEvent('ui-keydown', {272 target: this,273 data: { position: this.position, keys }274 });275 for (const child of this.children) {276 child.keydown(keys);277 }278 }279 }280 public keyup(keys: Record<string, KeyData>) {281 const enabled =282 this.attributeList.has('disabled') && !this.attributeList.get('disabled');283 if (enabled) {284 this.fireEvent('ui-keyup', {285 target: this,286 data: { position: this.position, keys }287 });288 for (const child of this.children) {289 child.keydown(keys);290 }291 }292 }293 public getChildren(): CanvasElement[] {294 return this.children;295 }296 public getAttribute<T = unknown>(key: string): T | undefined {297 return this.attributeList.get(key) as T | undefined;298 }299 public setAttribute(key: string, value: unknown) {300 this.attributeList.set(key, value);301 }302 public get position(): DOMPoint {303 return this.attributeList.get('position') as DOMPoint;304 }305 public set position(pos: DOMPoint) {306 const oldPos = this.position;307 this.attributeList.set('position', pos);308 this.hitBox.setPosition(pos);309 this.children.forEach((child) => {310 const childPos = child.position;311 const offset = new DOMPoint(childPos.x - oldPos.x, childPos.y - oldPos.y);312 const newPos = new DOMPoint(pos.x + offset.x, pos.y + offset.y);313 child.position = newPos;314 });315 }316 public get visible(): boolean {317 return this.attributeList.get('visible') as boolean;318 }319 public set visible(v: boolean) {320 this.attributeList.set('visible', v);321 }322 public get disabled(): boolean {323 return this.attributeList.get('disabled') as boolean;324 }325 public set disabled(d: boolean) {326 this.attributeList.set('disabled', d);327 }328 public getParent(): CanvasElement | null {329 return this._parent;330 }331 public set parent(el: CanvasElement) {332 this._parent = el;333 }334 public set height(h: number) {335 this.attributeList.set('height', h);336 this.hitBox.setDimensions(this.height, h);337 }338 public get height(): number {339 return this.attributeList.get('height') as number;340 }341 public set width(w: number) {342 this.attributeList.set('width', w);343 this.hitBox.setDimensions(w, this.width);344 }345 public get width(): number {346 return this.attributeList.get('width') as number;347 }348 public get content(): string {349 return this.attributeList.get('content') as string;350 }351 public set content(c: string) {352 this.attributeList.set('content', c);353 }354 public get size(): number {355 return this.attributeList.get('size') as number;356 }357 public set size(s: number) {358 this.attributeList.set('size', s);359 if (this.elementName === 'text') {360 this.attributeList.set(361 'height',362 s * ((this.attributeList.get('lineHeight') as number) || 1)363 );364 }365 for (const child of this.children) {366 if (child.elementName === 'text') {367 child.attributeList.set('size', s);368 }369 }370 }371 public get color(): string {372 return this.attributeList.get('color') as string;373 }374 public set color(c: string) {375 this.attributeList.set('color', c);376 this.children.forEach((child) => {377 if (child.elementName === 'text') {378 child.color = c;379 }380 });381 }382 public get family(): string {383 return this.attributeList.get('family') as string;384 }385 public set family(f: string) {386 this.attributeList.set('family', f);387 for (const child of this.children) {388 if (child.elementName === 'text') {389 child.family = f;390 }391 for (const subChild of child.getChildren()) {392 if (subChild.elementName === 'text') {393 subChild.family = f;394 }395 }396 }397 }398 public get borderColor(): string {399 return this.attributeList.get('borderColor') as string;400 }401 public set borderColor(bc: string) {402 this.attributeList.set('borderColor', bc);403 }404 public get padding(): number {405 return this.attributeList.get('padding') as number;406 }407 public set padding(p: number) {408 this.attributeList.set('padding', p);409 }410 public set borderImage(bi: TileMap | null) {411 this.attributeList.set('borderImage', bi);412 }413 public get borderImage(): TileMap | null {414 return this.attributeList.get('borderImage') as TileMap | null;415 }416 public set backgroundColor(bc: string) {417 this.attributeList.set('backgroundColr', bc);418 this.background.setColor(bc);419 }...
StructuralVariantAttributeList.js
Source:StructuralVariantAttributeList.js
1import PropTypes from 'prop-types'2import React from 'react'3import { QuestionMark } from '@broad/help'4import { Badge } from '@broad/ui'5import AttributeList from '../AttributeList'6import Link from '../Link'7import { svTypeLabels } from '../StructuralVariantList/structuralVariantTypes'8import StructuralVariantDetailPropType from './StructuralVariantDetailPropType'9const FILTER_DESCRIPTIONS = {10 PCRPLUS_ENRICHED: undefined,11 PREDICTED_GENOTYPING_ARTIFACT: undefined,12 UNRESOLVED: undefined,13 VARIABLE_ACROSS_BATCHES: undefined,14}15const EVIDENCE_LABELS = {16 BAF: 'Normalized B-allele frequency',17 PE: 'Anomalous paired-end reads',18 RD: 'Read depth',19 SR: 'Split reads',20}21const ALGORITHM_LABELS = {22 delly: 'DELLY',23 depth: 'Depth',24 manta: 'Manta',25 melt: 'MELT',26}27const COMPLEX_TYPE_LABELS = {28 CCR: 'Complex chromosomal rearrangement',29 dDUP: 'Dispersed duplication',30 dDUP_iDEL: 'Dispersed duplication with insert site deletion',31 delINV: 'Deletion-flanked inversion',32 delINVdel: 'Paired-deletion inversion',33 delINVdup: 'Inversion with flanking deletion and duplication',34 dupINV: 'Duplication-flanked inversion',35 dupINVdup: 'Paired-duplication inversion',36 dupINVdel: 'Inversion with flanking duplication and deletion',37 INVdel: 'Deletion-flanked inversion',38 INVdup: 'Duplication-flanked inversion',39 INS_iDEL: 'Insertion with insert site deletion',40 piDUP_FR: 'Palindromic inverted duplication',41 piDUP_RF: 'Palindromic inverted duplication',42}43const VariantPosition = ({ variant }) => {44 if (variant.type === 'INS') {45 return (46 <Link to={`/region/${variant.chrom}:${variant.pos}`}>47 {variant.chrom}:{variant.pos}48 </Link>49 )50 }51 if (variant.type === 'BND' || variant.type === 'CTX' || variant.chrom !== variant.end_chrom) {52 return (53 <span>54 <Link to={`/region/${variant.chrom}:${variant.pos}`}>55 {variant.chrom}:{variant.pos}56 </Link>{' '}57 |{' '}58 <Link to={`/region/${variant.end_chrom}:${variant.end_pos}`}>59 {variant.end_chrom}:{variant.end_pos}60 </Link>61 </span>62 )63 }64 return (65 <Link to={`/region/${variant.chrom}:${variant.pos}-${variant.end_pos}`}>66 {variant.chrom}:{variant.pos}-{variant.end_pos}67 </Link>68 )69}70VariantPosition.propTypes = {71 variant: StructuralVariantDetailPropType.isRequired,72}73const ComplexTypeHelpButton = ({ complexType }) => {74 if (!complexType) {75 return null76 }77 const helpTopic = {78 CCR: null,79 dDUP: 'sv-class_CPX_dDUP_dDUP-iDEL',80 dDUP_iDEL: 'sv-class_CPX_dDUP_dDUP-iDEL',81 delINV: 'sv-class_CPX_delINV_INVdel',82 delINVdel: 'sv-class_CPX_delINVdel',83 delINVdup: 'sv-class_CPX_delINVdup_dupINVdel',84 dupINV: 'sv-class_CPX_dupINV_INVdup',85 dupINVdel: 'sv-class_CPX_delINVdup_dupINVdel',86 dupINVdup: 'sv-class_CPX_dupINVdup',87 INS_iDEL: 'sv-class_CPX_INS-iDEL',88 INVdel: 'sv-class_CPX_delINV_INVdel',89 INVdup: 'sv-class_CPX_dupINV_INVdup',90 piDUP_FR: 'sv-class_CPX_piDUP-FR_piDUP-RF',91 piDUP_RF: 'sv-class_CPX_piDUP-FR_piDUP-RF',92 }[complexType]93 if (!helpTopic) {94 return null95 }96 return <QuestionMark topic={`SV_docs/${helpTopic}`} />97}98ComplexTypeHelpButton.propTypes = {99 complexType: PropTypes.string,100}101ComplexTypeHelpButton.defaultProps = {102 complexType: null,103}104const StructuralVariantAttributeList = ({ variant }) => (105 <AttributeList labelWidth={variant.type === 'MCNV' ? 180 : 140} style={{ marginTop: '1.25em' }}>106 <AttributeList.Item label="Filter">107 {variant.filters.length > 0 ? (108 variant.filters.map(filter => (109 <Badge key={filter} level="warning" tooltip={FILTER_DESCRIPTIONS[filter]}>110 {filter111 .split('_')112 .map(s => `${s.charAt(0)}${s.slice(1).toLowerCase()}`)113 .join(' ')}114 </Badge>115 ))116 ) : (117 <Badge level="success">Pass</Badge>118 )}119 </AttributeList.Item>120 <AttributeList.Item label={variant.type === 'MCNV' ? 'Non-Diploid Samples' : 'Allele Count'}>121 {variant.ac}122 </AttributeList.Item>123 <AttributeList.Item label={variant.type === 'MCNV' ? 'Total Samples' : 'Allele Number'}>124 {variant.an}125 </AttributeList.Item>126 <AttributeList.Item127 label={variant.type === 'MCNV' ? 'Non-diploid CN Frequency' : 'Allele Frequency'}128 >129 {(variant.an === 0 ? 0 : variant.ac / variant.an).toPrecision(4)}130 </AttributeList.Item>131 <AttributeList.Item label="Quality score">{variant.qual}</AttributeList.Item>132 <AttributeList.Item label="Position">133 <VariantPosition variant={variant} />134 </AttributeList.Item>135 {variant.type !== 'BND' && variant.type !== 'CTX' && (136 <AttributeList.Item label="Size">137 {variant.length === -1 ? 'â' : `${variant.length.toLocaleString()} bp`}138 </AttributeList.Item>139 )}140 <AttributeList.Item label="Class">141 {svTypeLabels[variant.type]} <QuestionMark topic={`SV_docs/sv-class_${variant.type}`} />142 </AttributeList.Item>143 {variant.type === 'CPX' && (144 <React.Fragment>145 <AttributeList.Item label="Complex SV Class">146 {variant.cpx_type} ({COMPLEX_TYPE_LABELS[variant.cpx_type]}){' '}147 <ComplexTypeHelpButton complexType={variant.cpx_type} />148 </AttributeList.Item>149 <AttributeList.Item label="Rearranged Segments">150 {variant.cpx_intervals.join(', ')}151 </AttributeList.Item>152 </React.Fragment>153 )}154 <AttributeList.Item label="Evidence">155 {variant.evidence.map(e => EVIDENCE_LABELS[e]).join(', ')}156 </AttributeList.Item>157 <AttributeList.Item label="Algorithms">158 {variant.algorithms.map(a => ALGORITHM_LABELS[a]).join(', ')}159 </AttributeList.Item>160 </AttributeList>161)162StructuralVariantAttributeList.propTypes = {163 variant: StructuralVariantDetailPropType.isRequired,164}...
allMarketStreams.js
Source:allMarketStreams.js
1const allMarketStreams = [2 {3 type: 'spot',4 streamList: [5 {6 streamName: 'aggregateTrade',7 code: '{symbol}@aggTrade',8 attributeList: ['symbol']9 },10 {11 streamName: 'trade',12 code: '{symbol}@trade',13 attributeList: ['symbol']14 },15 {16 streamName: 'kline',17 code: '{symbol}@kline_{interval}',18 attributeList: ['symbol', 'interval']19 },20 {21 streamName: 'miniTicker',22 code: '{symbol}@miniTicker',23 attributeList: ['symbol']24 },25 {26 streamName: 'allMarketMiniTicker',27 code: '!miniTicker@arr',28 attributeList: []29 },30 {31 streamName: 'ticker',32 code: '{symbol}@ticker',33 attributeList: ['symbol']34 },35 {36 streamName: 'allMarketTicker',37 code: '!ticker@arr',38 attributeList: []39 },40 {41 streamName: 'bookTicker',42 code: '{symbol}@bookTicker',43 attributeList: ['symbol']44 },45 {46 streamName: 'allBookTicker',47 code: '!bookTicker',48 attributeList: []49 },50 {51 streamName: 'partialBookDepth',52 code: '{symbol}@depth{levels}',53 attributeList: ['symbol', 'levels']54 },55 {56 streamName: 'diffBookDepth',57 code: '{symbol}@depth',58 attributeList: ['symbol']59 }60 ]61 },62 {63 type: 'uFutures',64 streamList: [65 {66 streamName: 'aggregateTrade',67 code: '{usymbol}@aggTrade',68 attributeList: ['usymbol']69 },70 {71 streamName: 'markPriceStream',72 code: '{usymbol}@markPrice',73 attributeList: ['usymbol']74 },75 {76 streamName: 'allMarkPriceStream',77 code: '!markPrice@arr',78 attributeList: []79 },80 {81 streamName: 'kline',82 code: '{usymbol}@kline_{interval}',83 attributeList: ['usymbol', 'interval']84 },85 {86 streamName: 'continuousKline',87 code: '{pair}_{contractType}@continuousKline_{interval}',88 attributeList: ['pair', 'contractType', 'interval']89 },90 {91 streamName: 'miniTicker',92 code: '{usymbol}@miniTicker',93 attributeList: ['usymbol']94 },95 {96 streamName: 'allMarketMiniTicker',97 code: '!miniTicker@arr',98 attributeList: []99 },100 {101 streamName: 'ticker',102 code: '{usymbol}@ticker',103 attributeList: ['usymbol']104 },105 {106 streamName: 'allMarketTicker',107 code: '!ticker@arr',108 attributeList: []109 },110 {111 streamName: 'bookTicker',112 code: '{usymbol}@bookTicker',113 attributeList: ['usymbol']114 },115 {116 streamName: 'allBookTicker',117 code: '!bookTicker',118 attributeList: []119 },120 {121 streamName: 'forceOrder',122 code: '{usymbol}@forceOrder',123 attributeList: ['usymbol']124 },125 {126 streamName: 'allForceOrder',127 code: '!forceOrder@arr',128 attributeList: []129 },130 {131 streamName: 'partialDepth',132 code: '{usymbol}@depth{levels}@500ms',133 attributeList: ['usymbol', 'levels']134 },135 {136 streamName: 'diffDepth',137 code: '{usymbol}@depth@500ms',138 attributeList: ['usymbol']139 }140 ]141 },142 {143 type: 'cFutures',144 streamList: [145 {146 streamName: 'aggregateTrade',147 code: '{csymbol}@aggTrade',148 attributeList: ['csymbol']149 },150 {151 streamName: 'indexPrice',152 code: '{cpair}@indexPrice',153 attributeList: ['cpair']154 },155 {156 streamName: 'markPrice',157 code: '{csymbol}@markPrice',158 attributeList: ['csymbol']159 },160 {161 streamName: 'pairMarkPrice',162 code: '{cpair}@markPrice',163 attributeList: ['cpair']164 },165 {166 streamName: 'kline',167 code: '{csymbol}@kline_{interval}',168 attributeList: ['csymbol', 'interval']169 },170 {171 streamName: 'continuousKline',172 code: '{cpair}_{contractType}@continuousKline_{interval}',173 attributeList: ['cpair', 'contractType', 'interval']174 },175 {176 streamName: 'indexKline',177 code: '{cpair}@indexPriceKline_{interval}',178 attributeList: ['cpair', 'interval']179 },180 {181 streamName: 'markKline',182 code: '{csymbol}@markPriceKline_{interval}',183 attributeList: ['csymbol', 'interval']184 },185 {186 streamName: 'miniTicker',187 code: '{csymbol}@miniTicker',188 attributeList: ['csymbol']189 },190 {191 streamName: 'allMarketMiniTicker',192 code: '!miniTicker@arr',193 attributeList: []194 },195 {196 streamName: 'ticker',197 code: '{csymbol}@ticker',198 attributeList: ['csymbol']199 },200 {201 streamName: 'allMarketTicker',202 code: '!ticker@arr',203 attributeList: []204 },205 {206 streamName: 'bookTicker',207 code: '{csymbol}@bookTicker',208 attributeList: ['csymbol']209 },210 {211 streamName: 'allBookTicker',212 code: '!bookTicker',213 attributeList: []214 },215 {216 streamName: 'forceOrder',217 code: '{csymbol}@forceOrder',218 attributeList: ['csymbol']219 },220 {221 streamName: 'allForceOrder',222 code: '!forceOrder@arr',223 attributeList: []224 },225 {226 streamName: 'partialDepth',227 code: '{csymbol}@depth{levels}@500ms',228 attributeList: ['csymbol', 'levels']229 },230 {231 streamName: 'diffDepth',232 code: '{csymbol}@depth@500ms',233 attributeList: ['csymbol']234 }235 ]236 }237];...
Using AI Code Generation
1var tracetest = require('tracetest');2tracetest.attributeList('test.js');3var tracetest = require('tracetest');4tracetest.attributeList('test.js');5var tracetest = require('tracetest');6tracetest.attributeList('test.js');7var tracetest = require('tracetest');8tracetest.attributeList('test.js');9var tracetest = require('tracetest');10tracetest.attributeList('test.js');11var tracetest = require('tracetest');12tracetest.attributeList('test.js');13var tracetest = require('tracetest');14tracetest.attributeList('test.js');15var tracetest = require('tracetest');16tracetest.attributeList('test.js');17var tracetest = require('tracetest');18tracetest.attributeList('test.js');19var tracetest = require('tracetest');20tracetest.attributeList('test.js');21var tracetest = require('tracetest');22tracetest.attributeList('test.js');23var tracetest = require('tracetest');24tracetest.attributeList('test.js');25var tracetest = require('tracetest');26tracetest.attributeList('test.js');
Using AI Code Generation
1var tracetest = require('tracetest');2var trace = tracetest.trace;3var trace1 = tracetest.trace1;4var attributeList = tracetest.attributeList;5trace("Hello World");6trace1("Hello World");7attributeList("Hello World");8exports.trace = function(msg) {9 console.log(msg);10};11exports.trace1 = function(msg) {12 console.log(msg);13};14exports.attributeList = function(msg) {15 console.log(msg);16};
Using AI Code Generation
1var tracetest = require('tracetest');2var trace = new tracetest.TraceTest();3console.log(trace.attributeList());4var TraceTest = function() {5 this.name = 'test';6 this.id = 1;7}8TraceTest.prototype.attributeList = function() {9 var attributeList = [];10 for (var attr in this) {11 if (this.hasOwnProperty(attr)) {12 attributeList.push(attr);13 }14 }15 return attributeList;16}17module.exports = TraceTest;
Using AI Code Generation
1var tracetest = require('tracetest');2var attrList = tracetest.attributeList();3attrList.forEach(function(attr){4 console.log(attr);5});6{ name: 'name', value: 'John' }7{ name: 'age', value: '25' }
Using AI Code Generation
1var trace = require('./tracetest.js');2trace.attributeList('test');3exports.attributeList = function attributeList(id) {4 var attributes = {5 };6 return attributes;7}
Using AI Code Generation
1var trace = require('trace');2trace.setConfig({logLevel: 3});3trace.attributeList('test', 'info', 'test', 'test');4var trace = require('trace');5trace.setConfig({logLevel: 3});6trace.attributeList('test', 'info', 'test', 'test');7var trace = require('trace');8trace.setConfig({logLevel: 3});9trace.attributeList('test', 'info', 'test', 'test');10var trace = require('trace');11trace.setConfig({logLevel: 3});12trace.attributeList('test', 'info', 'test', 'test');13var trace = require('trace');14trace.setConfig({logLevel: 3});15trace.attributeList('test', 'info', 'test', 'test');16var trace = require('trace');17trace.setConfig({logLevel: 3});18trace.attributeList('test', 'info', 'test', 'test');19var trace = require('trace');20trace.setConfig({logLevel: 3});21trace.attributeList('test', 'info', 'test', 'test');22var trace = require('trace');23trace.setConfig({logLevel: 3});24trace.attributeList('test', 'info', 'test', 'test');25var trace = require('trace');26trace.setConfig({logLevel: 3});27trace.attributeList('test', 'info', 'test', 'test');28var trace = require('trace');29trace.setConfig({logLevel: 3});30trace.attributeList('test', 'info', 'test', '
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!