How to use cof method in wpt

Best JavaScript code snippet using wpt

Clock.js

Source:Clock.js Github

copy

Full Screen

1import React from "react";2export class Clock extends React.Component{3 constructor(props) {4 super(props);5 this.state = {date: new Date()};6 }7 componentDidMount() {8 this.timerID = setInterval(9 () => this.newTime(),10 70011 );12 }13 componentWillUnmount() {14 clearInterval(this.timerID);15 }16 newTime(){17 this.setState({18 date: new Date()19 });20 this.makeElectricStyle(this.props.type);21 }22 makeElectricStyle(type){23 const clock = this.refs.canvas.getContext('2d');24 let width = this.refs.canvas.width;25 clock.clearRect(0,0,width,width);26 clock.fillStyle = 'black';27 let now = new Date();28 let date =now.toDateString();29 let hours = now.getHours();30 let minutes = now.getMinutes();31 let firstCountHours = Math.floor(hours/10);32 let secondCountHours = hours%10;33 let firstCountMinutes = Number(Math.floor(minutes/10));34 let secondCountMinutes = Number(minutes%10);35 switch (type) {36 case 1:37 width = width/2;38 this.paintCount(clock,50*width/1000,160*width/1000,firstCountHours,800,width);39 this.paintCount(clock,250*width/1000,160*width/1000,secondCountHours,800,width);40 this.paintStick(clock,465*width/1000,260*width/1000,6,800,width);41 // switch (firstCountMinutes) {42 // case 1:43 // this.paintCount(clock,450*width/1000,160*width/1000,firstCountMinutes,800,width);44 // this.paintCount(clock,650*width/1000,160*width/1000,secondCountMinutes,800,width);45 // break;46 // case 2 :47 this.paintCount(clock,550*width/1000,160*width/1000,firstCountMinutes,800,width);48 this.paintCount(clock,750*width/1000,160*width/1000,secondCountMinutes,800,width);49 // break;50 // case 0:51 // this.paintCount(clock,550*width/1000,160*width/1000,firstCountMinutes,800,width);52 // this.paintCount(clock,750*width/1000,160*width/1000,secondCountMinutes,800,width);53 // break;54 // }55 clock.font = 0.08 * width + 'px Arial';56 clock.fillText('Now is:' + date,0.05*width,0.6*width,4000);57 break;58 case 2:59 this.paintCount(clock,280*width/1000,50*width/1000,firstCountHours,700,width);60 this.paintCount(clock,520*width/1000,50*width/1000,secondCountHours,700,width);61 this.paintCount(clock,280*width/1000,450*width/1000,firstCountMinutes,700,width);62 this.paintCount(clock,520*width/1000,450*width/1000,secondCountMinutes,700,width);63 clock.font = 0.08 * width + 'px Arial';64 let arr = date.split(" ");65 clock.fillText( arr[1]+" "+arr[2]+" "+arr[3],0.27*width,910*width/1000,4000);66 break;67 default:68 break69 }70 }71 paintStick(clock,x,y,type,coef,width){72 let cof = coef;73 switch (type) {74 case 1:75 clock.fillStyle = 'black';76 clock.beginPath();77 clock.moveTo(x,y+5*width/cof);78 clock.lineTo(x+10*width/cof,y);79 clock.lineTo(x+100*width/cof,y);80 clock.lineTo(x+110*width/cof,y+5*width/cof);81 clock.lineTo(x+95*width/cof,y+10*2*width/cof);82 clock.lineTo(x+15*width/cof,y+10*2*width/cof);83 clock.closePath();84 clock.fill();85 break;86 case 2:87 clock.fillStyle = 'black';88 clock.beginPath();89 clock.moveTo(x+5*width/cof,y);90 clock.lineTo(x,y+10*width/cof);91 clock.lineTo(x,y+100*width/cof);92 clock.lineTo(x+5*width/cof,y+110*width/cof);93 clock.lineTo(x+10*2*width/cof,y+95*width/cof);94 clock.lineTo(x+10*2*width/cof,y+15*width/cof);95 clock.closePath();96 clock.fill();97 break;98 case 3:99 clock.fillStyle ='black';100 clock.beginPath();101 clock.moveTo(x+15*width/cof,y);102 clock.lineTo(x+20*width/cof,y+10*width/cof);103 clock.lineTo(x+20*width/cof,y+100*width/cof);104 clock.lineTo(x+15*width/cof,y+110*width/cof);105 clock.lineTo(x,y+95*width/cof);106 clock.lineTo(x,y+15*width/cof);107 clock.closePath();108 clock.fill();109 break;110 case 4:111 clock.fillStyle = 'black';112 clock.beginPath();113 clock.moveTo(x,y+10*width/cof);114 clock.lineTo(x+10*width/cof,y);115 clock.lineTo(x+100*width/cof,y);116 clock.lineTo(x+110*width/cof,y+10*width/cof);117 clock.lineTo(x+100*width/cof,y+10*2*width/cof);118 clock.lineTo(x+10*width/cof,y+10*2*width/cof);119 clock.closePath();120 clock.fill();121 break;122 case 5:123 clock.fillStyle = 'black';124 clock.beginPath();125 clock.moveTo(x,y+15*width/cof);126 clock.lineTo(x+15*width/cof,y);127 clock.lineTo(x+95*width/cof,y);128 clock.lineTo(x+110*width/cof,y+15*width/cof);129 clock.lineTo(x+100*width/cof,y+10*2*width/cof);130 clock.lineTo(x+10*width/cof,y+10*2*width/cof);131 clock.closePath();132 clock.fill();133 break;134 case 6:135 clock.fillStyle = 'black';136 clock.beginPath();137 clock.fillRect(x+width/(cof),y+width/(cof),width/(cof/25),width/(cof/25));138 clock.fillRect(x+width/(cof),y+100*width/(cof),width/(cof/25),width/(cof/25));139 clock.closePath();140 clock.fill();141 break;142 default:break;143 }144 }145 paintCount(clock,x,y,count,coef,width){146 let cof=coef;147 switch (count) {148 case 0:149 this.paintStick(clock,x+10*width/cof,y+10*width/cof,1,cof,width);150 this.paintStick(clock,x,y+20*width/cof,2,cof,width);151 this.paintStick(clock,x,y+150*width/cof,2,cof,width);152 this.paintStick(clock,x+110*width/cof,y+20*width/cof,3,cof,width);153 this.paintStick(clock,x+110*width/cof,y+150*width/cof,3,cof,width);154 this.paintStick(clock,x+10*width/cof,y+250*width/cof,5,cof,width);155 break;156 case 1:157 this.paintStick(clock,x+110*width/cof,y+20*width/cof,3,cof,width);158 this.paintStick(clock,x+110*width/cof,y+150*width/cof,3,cof,width);159 break;160 break;161 case 2:162 this.paintStick(clock,x+10*width/cof,y+10*width/cof,1,cof,width);163 this.paintStick(clock,x,y+150*width/cof,2,cof,width);164 this.paintStick(clock,x+110*width/cof,y+20*width/cof,3,cof,width);165 this.paintStick(clock,x+10*width/cof,y+130*width/cof,4,cof,width);166 this.paintStick(clock,x+10*width/cof,y+250*width/cof,5,cof,width);167 break;168 case 3:169 this.paintStick(clock,x+10*width/cof,y+10*width/cof,1,cof,width);170 this.paintStick(clock,x+110*width/cof,y+20*width/cof,3,cof,width);171 this.paintStick(clock,x+110*width/cof,y+150*width/cof,3,cof,width);172 this.paintStick(clock,x+10*width/cof,y+130*width/cof,4,cof,width);173 this.paintStick(clock,x+10*width/cof,y+250*width/cof,5,cof,width);174 break;175 case 4:176 this.paintStick(clock,x,y+20*width/cof,2,cof,width);177 this.paintStick(clock,x+110*width/cof,y+20*width/cof,3,cof,width);178 this.paintStick(clock,x+110*width/cof,y+150*width/cof,3,cof,width);179 this.paintStick(clock,x+10*width/cof,y+130*width/cof,4,cof,width);180 break;181 case 5:182 this.paintStick(clock,x+10*width/cof,y+10*width/cof,1,cof,width);183 this.paintStick(clock,x,y+20*width/cof,2,cof,width);184 this.paintStick(clock,x+110*width/cof,y+150*width/cof,3,cof,width);185 this.paintStick(clock,x+10*width/cof,y+130*width/cof,4,cof,width);186 this.paintStick(clock,x+10*width/cof,y+250*width/cof,5,cof,width);187 break;188 case 6:189 this.paintStick(clock,x+10*width/cof,y+10*width/cof,1,cof,width);190 this.paintStick(clock,x,y+20*width/cof,2,cof,width);191 this.paintStick(clock,x,y+150*width/cof,2,cof,width);192 this.paintStick(clock,x+110*width/cof,y+150*width/cof,3,cof,width);193 this.paintStick(clock,x+10*width/cof,y+130*width/cof,4,cof,width);194 this.paintStick(clock,x+10*width/cof,y+250*width/cof,5,cof,width);195 break;196 case 7:197 this.paintStick(clock,x+10*width/cof,y+10*width/cof,1,cof,width);198 this.paintStick(clock,x+110*width/cof,y+20*width/cof,3,cof,width);199 this.paintStick(clock,x+110*width/cof,y+150*width/cof,3,cof,width);200 break;201 case 8:202 this.paintStick(clock,x+10*width/cof,y+10*width/cof,1,cof,width);203 this.paintStick(clock,x,y+20*width/cof,2,cof,width);204 this.paintStick(clock,x,y+150*width/cof,2,cof,width);205 this.paintStick(clock,x+110*width/cof,y+20*width/cof,3,cof,width);206 this.paintStick(clock,x+110*width/cof,y+150*width/cof,3,cof,width);207 this.paintStick(clock,x+10*width/cof,y+130*width/cof,4,cof,width);208 this.paintStick(clock,x+10*width/cof,y+250*width/cof,5,cof,width);209 break;210 case 9:211 this.paintStick(clock,x+10*width/cof,y+10*width/cof,1,cof,width);212 this.paintStick(clock,x,y+20*width/cof,2,cof,width);213 this.paintStick(clock,x+110*width/cof,y+20*width/cof,3,cof,width);214 this.paintStick(clock,x+110*width/cof,y+150*width/cof,3,cof,width);215 this.paintStick(clock,x+10*width/cof,y+130*width/cof,4,cof,width);216 this.paintStick(clock,x+10*width/cof,y+250*width/cof,5,cof,width);217 break;218 }219 }220 render() {221 const {clockSize} = this.props;222 return(223 <div id={'clockPlace'}>224 <canvas ref={'canvas'} id={'clock'} width={clockSize} height={clockSize} />225 </div>226 )227 }...

Full Screen

Full Screen

FuncCode.js

Source:FuncCode.js Github

copy

Full Screen

1export default {2 cof_f_auth_tpl_add:'cof-f-auth-tpl-add', //添加权限模板 function3 cof_f_auth_tpl_add_res_group:'cof-f-auth-tpl-add-res-group', //权限模板添加资源组 function4 cof_f_auth_tpl_del:'cof-f-auth-tpl-del', //删除权限模板 function5 cof_f_auth_tpl_edit:'cof-f-auth-tpl-edit', //编辑权限模板 function6 cof_f_auth_tpl_rm_res_group:'cof-f-auth-tpl-rm-res-group', //权限模板移除资源组 function7 cof_f_dict_download_tpl:'cof-f-dict-download-tpl', //下载导入模板 function8 cof_f_dict_entry_add:'cof-f-dict-entry-add', //添加字典项 function9 cof_f_dict_entry_del:'cof-f-dict-entry-del', //删除字典项 function10 cof_f_dict_entry_edit:'cof-f-dict-entry-edit', //编辑字典项 function11 cof_f_dict_export:'cof-f-dict-export', //导出数据字典 function12 cof_f_dict_import:'cof-f-dict-import', //导入数据字典 function13 cof_f_dict_type_add:'cof-f-dict-type-add', //添加字典类型 function14 cof_f_dict_type_del:'cof-f-dict-type-del', //删除字典类型 function15 cof_f_dict_type_edit:'cof-f-dict-type-edit', //编辑字典类型 function16 cof_f_dimension_add:'cof-f-dimension-add', //添加机构树 function17 cof_f_dimension_del:'cof-f-dimension-del', //删除机构树 function18 cof_f_dimension_edit:'cof-f-dimension-edit', //编辑机构树 function19 cof_f_emp_add:'cof-f-emp-add', //添加员工 function20 cof_f_emp_del:'cof-f-emp-del', //删除员工 function21 cof_f_emp_edit:'cof-f-emp-edit', //编辑员工 function22 cof_f_function_add:'cof-f-function-add', //添加功能 function23 cof_f_function_del:'cof-f-function-del', //删除功能 function24 cof_f_function_edit:'cof-f-function-edit', //编辑功能 function25 cof_f_function_scan:'cof-f-function-scan', //功能扫描 function26 cof_f_member_add:'cof-f-member-add', //添加成员 function27 cof_f_member_del:'cof-f-member-del', //删除成员 function28 cof_f_menu_add:'cof-f-menu-add', //添加菜单 function29 cof_f_menu_del:'cof-f-menu-del', //删除菜单 function30 cof_f_menu_edit:'cof-f-menu-edit', //编辑菜单 function31 cof_f_optlog_detail_get:'cof-f-optlog-detail-get', //查看操作日志详情 function32 cof_f_optlog_search:'cof-f-optlog-search', //查询操作日志 function33 cof_f_org_add:'cof-f-org-add', //添加机构 function34 cof_f_org_del:'cof-f-org-del', //删除机构 function35 cof_f_org_edit:'cof-f-org-edit', //编辑机构 function36 cof_f_org_emp_add:'cof-f-org-emp-add', //添加机构员工 function37 cof_f_org_emp_del:'cof-f-org-emp-del', //移除机构员工 function38 cof_f_position_add:'cof-f-position-add', //添加岗位 function39 cof_f_position_del:'cof-f-position-del', //删除岗位 function40 cof_f_position_edit:'cof-f-position-edit', //编辑岗位 function41 cof_f_position_emp_add:'cof-f-position-emp-add', //岗位添加员工 function42 cof_f_position_emp_del:'cof-f-position-emp-del', //岗位移除员工 function43 cof_f_res_group_add:'cof-f-res-group-add', //添加资源组 function44 cof_f_res_group_del:'cof-f-res-group-del', //删除资源组 function45 cof_f_res_group_edit:'cof-f-res-group-edit', //编辑资源组 function46 cof_f_role_add:'cof-f-role-add', //添加角色 function47 cof_f_role_bind:'cof-f-role-bind', //角色绑定用户 function48 cof_f_role_del:'cof-f-role-del', //删除角色 function49 cof_f_role_edit:'cof-f-role-edit', //编辑角色 function50 cof_f_role_edit_res:'cof-f-role-edit-res', //角色授权 function51 cof_f_role_tpl_add:'cof-f-role-tpl-add', //添加角色模板 function52 cof_f_role_tpl_del:'cof-f-role-tpl-del', //删除角色模板 function53 cof_f_role_tpl_edit:'cof-f-role-tpl-edit', //编辑角色模板 function54 cof_f_role_tpl_edit_res:'cof-f-role-tpl-edit-res', //角色模板授权 function55 cof_f_role_tpl_grp_add:'cof-f-role-tpl-grp-add', //添加角色模板组 function56 cof_f_role_tpl_grp_del:'cof-f-role-tpl-grp-del', //删除角色模板组 function57 cof_f_role_tpl_grp_edit:'cof-f-role-tpl-grp-edit', //编辑角色模板组 function58 cof_f_role_unbind:'cof-f-role-unbind', //角色与用户解绑 function59 cof_f_user_add:'cof-f-user-add', //添加用户 function60 cof_f_user_change_pw:'cof-f-user-change-pw', //修改用户密码 function61 cof_f_user_del:'cof-f-user-del', //删除用户 function62 cof_f_user_edit:'cof-f-user-edit', //编辑用户 function63 cof_f_user_edit_status:'cof-f-user-edit-status', //启用/禁用用户 function64 cof_f_user_reset_pw:'cof-f-user-reset-pw', //重置用户密码 function65 cof_f_workgroup_add:'cof-f-workgroup-add', //添加工作组 function66 cof_f_workgroup_add_emp:'cof-f-workgroup-add-emp', //添加工作组员工 function67 cof_f_workgroup_del:'cof-f-workgroup-del', //删除工作组 function68 cof_f_workgroup_edit:'cof-f-workgroup-edit', //编辑工作组 function69 cof_f_workgroup_rm_emp:'cof-f-workgroup-rm-emp', //移除工作组员工 function70 cof_m_audit:'cof-m-audit', //安全审计 menu71 cof_m_auth:'cof-m-auth', //权限管理 menu72 cof_m_dict:'cof-m-dict', //业务字典 menu73 cof_m_emp:'cof-m-emp', //人员管理 menu74 cof_m_member:'cof-m-member', //平台成员 menu75 cof_m_opt_log:'cof-m-opt-log', //操作日志 menu76 cof_m_org:'cof-m-org', //组织机构 menu77 cof_m_org_tree:'cof-m-org-tree', //机构岗位 menu78 cof_m_resouce_right:'cof-m-resouce-right', //资源权限 menu79 cof_m_role:'cof-m-role', //平台角色 menu80 cof_m_role_template:'cof-m-role-template', //角色模板 menu81 cof_m_sys:'cof-m-sys', //系统配置 menu82 cof_m_user:'cof-m-user', //用户管理 menu83 fl:'fl', //测试 menu84 // fl2:'fl2', //测试 menu85 // fl2Delete:'fl2Delete',//86 // sousuo:'sousuo', //测试 menu87 // shujubaobiao:'shujubaobiao', //测试 menu88 // fl3:'fl3', //测试 menu89 // fl4:'fl4', //测试 menu90 // fl5:'fl5', //测试 menu91 role3: 'role3', // llp测试 menu92 // role2: 'role2', // llp测试 menu93 // m2role1: 'm2role1', // llp测试 menu94 // m2role2: 'm2role2' // llp测试 menu...

Full Screen

Full Screen

calculatorReducer.js

Source:calculatorReducer.js Github

copy

Full Screen

1import { createSlice } from '@reduxjs/toolkit';2const initialState = {3 usagePriceIs: 0,4 registrationPriceIs: 0,5 euroStandard: '',6 co2Amount: '',7 co2Coefficient: { registrationCof: 0, useCof: 0 },8 carType: {9 diesel: { checked: false, Euro6: 1.7, Euro5: 2, Euro43: 2.3, Euro21: 2.5 },10 petrol: { checked: false, Euro6: 0.9, Euro5: 1, Euro43: 1.1, Euro21: 1.4 },11 gas: { checked: false, Euro6: 0.8, Euro5: 0.9, Euro43: 1, Euro21: 1.3 },12 },13};14const calculatorReducer = createSlice({15 name: 'calculator',16 initialState,17 reducers: {18 setCo2Amount(state, action) {19 state.co2Amount = action.payload;20 //Set correct Co2 and registration coefficients (registrationCof, useCof) depending on Co2Amount value.21 let [regCof, useCof] = [0, 0];22 action.payload >= 251 && ([regCof, useCof] = [3, 0.36]);23 action.payload <= 250 &&24 action.payload >= 201 &&25 ([regCof, useCof] = [2.2, 0.28]);26 action.payload <= 200 &&27 action.payload >= 161 &&28 ([regCof, useCof] = [1.5, 0.19]);29 action.payload <= 160 &&30 action.payload >= 131 &&31 ([regCof, useCof] = [1.1, 0.14]);32 action.payload <= 130 && ([regCof, useCof] = [0, 0]);33 [state.co2Coefficient.registrationCof, state.co2Coefficient.useCof] = [34 regCof,35 useCof,36 ];37 },38 setEuroStandard(state, action) {39 state.euroStandard = action.payload;40 },41 setCarType(state, action) {42 //Allow a single checkbox to be checked.43 for (const key in state.carType) {44 key === action.payload45 ? (state.carType[key].checked = !state.carType[key].checked)46 : (state.carType[key].checked = false);47 }48 },49 calculateCost(state) {50 for (const key in state.carType) {51 if (state.carType[key].checked) {52 const euroStandard = state.euroStandard;53 const euroStandCof = state.carType[key][euroStandard];54 state.registrationPriceIs =55 state.co2Amount *56 state.co2Coefficient.registrationCof *57 euroStandCof;58 state.usagePriceIs =59 state.co2Amount * state.co2Coefficient.useCof * euroStandCof;60 }61 }62 },63 },64});65export const { setEuroStandard, setCo2Amount, setCarType, calculateCost } =66 calculatorReducer.actions;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var config = {3};4var test = new wpt(config);5}, function(err, data) {6 if (err) {7 console.log(err);8 }9 console.log(data);10});11var wpt = require('wpt');12var config = {13};14var test = new wpt(config);15}, function(err, data) {16 if (err) {17 console.log(err);18 }19 console.log(data);20});21test.getTestStatus('testid', function(err, data) {22 if (err) {23 console.log(err);24 }25 console.log(data);26});27test.getTestResults('testid', function(err, data) {28 if (err) {29 console.log(err);30 }31 console.log(data);32});33test.getTestResultsByLocation('testid', function(err, data) {34 if (err) {35 console.log(err);36 }37 console.log(data);38});39test.getTestRequests('testid', function(err, data) {40 if (err) {41 console.log(err);42 }43 console.log(data);44});45test.getTestBreakdown('testid', function(err, data) {46 if (err) {47 console.log(err);48 }49 console.log(data);50});51test.getTestPageSpeed('testid', function(err, data) {52 if (err) {53 console.log(err);54 }55 console.log(data);56});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4var test = wpt(options);5 if (err) return console.error(err);6 console.log('Test started: ' + data.data.testId);7 test.getTestResults(data.data.testId, function(err, data) {8 if (err) return console.error(err);9 console.log('Test completed');10 console.log(data.data.median.firstView.SpeedIndex);11 });12});

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful