Best JavaScript code snippet using wpt
seed.ts
Source:seed.ts
...268 const date = new Date(new Date().getTime() - Math.random() * (1e+12))269 return date270}271const userList = [272 { "name": "Leanne Graham", "email": "Sincere@april.biz", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },273 { "name": "Ervin Howell", "email": "Shanna@melissa.tv", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },274 { "name": "Clementine Bauch", "email": "Nathan@yesenia.net", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },275 { "name": "Patricia Lebsack", "email": "Julianne.OConner@kory.org", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },276 { "name": "Chelsey Dietrich", "email": "Lucio_Hettinger@annie.ca", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },277 { "name": "Mrs. Dennis Schulist", "email": "Karley_Dach@jasper.info", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },278 { "name": "Kurtis Weissnat", "email": "Telly.Hoeger@billy.biz", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },279 { "name": "Nicholas Runolfsdottir V", "email": "Sherwood@rosamond.me", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },280 { "name": "Glenna Reichert", "email": "Chaim_McDermott@dana.io", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },281 { "name": "Clementina DuBuque", "email": "Rey.Padberg@karina.biz", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },282 { "name": "sunt", "email": "quiaas@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },283 { "name": "qui", "email": "estdfsf@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },284 { "name": "ea", "email": "etdfs@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },285 { "name": "eum", "email": "ullamdfs@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },286 { "name": "nesciunt", "email": "repudiandaese@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },287 { "name": "dolorem", "email": "utewf@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },288 { "name": "magnam", "email": "doloreewaew@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },289 { "name": "dolorem", "email": "dignissimosacea@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },290 { "name": "nesciunt", "email": "consecteturewv@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },291 { "name": "optio", "email": "quouyj@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },292 { "name": "et", "email": "delectuserb@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },293 { "name": "in", "email": "itaquerb@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },294 { "name": "dolorum", "email": "autdbfgs@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },295 { "name": "voluptatem", "email": "fugasvd@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },296 { "name": "eveniet", "email": "reprehenderitxx@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },297 { "name": "sint", "email": "suscipit@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },298 { "name": "fugit", "email": "eosxdd@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },299 { "name": "voluptate", "email": "evenietdsfd@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },300 { "name": "adipisci", "email": "illumsfdsf@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },301 { "name": "doloribus", "email": "quixxxxe3e@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },302 { "name": "asperiores", "email": "repellat222@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },303 { "name": "dolor", "email": "eoscs@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },304 { "name": "maxime", "email": "vscdseritatis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },305 { "name": "autem", "email": "ensdvgsim@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },306 { "name": "rem", "email": "ullagdgm@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },307 { "name": "est", "email": "simdvilique@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },308 { "name": "quasi", "email": "esdrfum@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },309 { "name": "delectus", "email": "nfddon@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },310 { "name": "iusto", "email": "odsfsdit@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },311 { "name": "a", "email": "alisvsdas@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },312 { "name": "ullam", "email": "debitsis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },313 { "name": "doloremque", "email": "desvserunt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },314 { "name": "qui", "email": "rerumsss@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },315 { "name": "magnam", "email": "esvsda@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },316 { "name": "id", "email": "nissvsdi@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },317 { "name": "fuga", "email": "adsvdsv@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },318 { "name": "provident", "email": "desvbitis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },319 { "name": "explicabo", "email": "anisdvmi@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },320 { "name": "eos", "email": "corsvdporis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },321 { "name": "enim", "email": "usvrtet@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },322 { "name": "non", "email": "molsdvestias@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },323 { "name": "commodi", "email": "odsdvsio@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },324 { "name": "eligendi", "email": "similsdique@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },325 { "name": "optio", "email": "tesdvmporibus@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },326 { "name": "ut", "email": "estsvdw@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },327 { "name": "aut", "email": "volusvhyptatem@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },328 { "name": "quibusdam", "email": "savoluptatem@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },329 { "name": "ut", "email": "voluptdvates@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },330 { "name": "laborum", "email": "insdvaventore@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },331 { "name": "repellendus", "email": "errovar@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },332 { "name": "soluta", "email": "savebunt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },333 { "name": "qui", "email": "iustvsvdo@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },334 { "name": "ut", "email": "minimsaea@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },335 { "name": "sit", "email": "totambra@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },336 { "name": "sit", "email": "debitibres@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },337 { "name": "qui", "email": "aaveraut@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },338 { "name": "sed", "email": "aabrnt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },339 { "name": "voluptatum", "email": "veveaniam@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },340 { "name": "qui", "email": "perspicavaiatis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },341 { "name": "consequatur", "email": "aspvdsaeriores@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },342 { "name": "voluptatem", "email": "aabvab@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },343 { "name": "beatae", "email": "eniavam@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },344 { "name": "voluptas", "email": "enimotnt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },345 { "name": "et", "email": "iddys@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },346 { "name": "consequatur", "email": "volsnytuptatibus@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },347 { "name": "repudiandae", "email": "offsnticia@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },348 { "name": "aliquid", "email": "represtnhenderit@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },349 { "name": "odio", "email": "magnasntm@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },350 { "name": "fugiat", "email": "offstniciis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },351 { "name": "voluptatem", "email": "ssntunt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },352 { "name": "et", "email": "occasntecati@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },353 { "name": "sint", "email": "quastnm@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },354 { "name": "consequuntur", "email": "volusntptatem@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },355 { "name": "enim", "email": "odistt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },356 { "name": "dignissimos", "email": "commonstdi@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },357 { "name": "doloremque", "email": "sntsnut@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },358 { "name": "necessitatibus", "email": "mosntsdi@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },359 { "name": "quam", "email": "nostnsbis@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },360 { "name": "pariatur", "email": "libersnto1@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },361 { "name": "labore", "email": "sntsex@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },362 { "name": "tempora", "email": "fasntscere@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },363 { "name": "laudantium", "email": "ustnt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },364 { "name": "odit", "email": "etnsnst@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },365 { "name": "optio", "email": "sitnsntnt@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },366 { "name": "dolore", "email": "sisntsmilique@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },367 { "name": "placeat", "email": "qustnstasi@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },368 { "name": "nostrum", "email": "esntsos@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },369 { "name": "sapiente", "email": "consstnsequatur@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },370 { "name": "sint", "email": "resntpellat@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },371 { "name": "ad", "email": "minsntus@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },372 { "name": "aut", "email": "libstnero@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },373 { "name": "ratione", "email": "asntut@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },374 { "name": "beatae", "email": "dosntlorem@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },375 { "name": "qui", "email": "assntpernatur@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },376 { "name": "id", "email": "earusntm@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },377 { "name": "quaerat", "email": "instn@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },378 { "name": "quas", "email": "eusnttsntm@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },379 { "name": "laboriosam", "email": "dolorstnemque@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },380 { "name": "temporibus", "email": "qusntntnjto@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() },381 { "name": "cupiditate", "email": "cupidsntitate@me.com", countryCode: getCountry(), device: getDevice(), gender: getGender(), usageTimeInMin: getUtime(), lastActive: getRandomDate() }382]383const doSeed = async () => {384 // clear seed385 await prisma.country.deleteMany()386 await prisma.users.deleteMany()387 //* create demo country388 await prisma.country.createMany({389 data: countryList390 })391 //* create demo users392 await prisma.users.createMany({393 data: userList394 })395}...
test-device.ts
Source:test-device.ts
...94 if (childId !== undefined) {95 // @ts-ignore: childId is only on plugs, but harmless96 testDevice.deviceOptions.childId = childId;97 }98 testDevice.getDevice = function getDevice(99 deviceOptions?: Parameters<Client['getDevice']>[0],100 sendOptions?: Parameters<Client['getDevice']>[1]101 ): ReturnType<Client['getDevice']> {102 return client.getDevice(103 {104 ...testDevice.deviceOptions,105 defaultSendOptions: sendOptions,106 ...deviceOptions,107 } as Parameters<Client['getDevice']>[0], // TODO: I don't like this cast but only way I could get it to work108 sendOptions109 );110 };111 if ('children' in device && device.children.size > 0) {112 if (testDevice.childId === undefined) {113 testDevice.children = ((): MarkRequired<114 TestDevice,115 'getDevice' | 'childId' | 'parent'116 >[] => {117 return Array.from(device.children.keys()).map((key) => {118 return createTestDevice(device, client, {119 name: testDevice.name,120 model: testDevice.model,121 hardwareVersion: testDevice.hardwareVersion,122 isSimulated: testDevice.isSimulated,123 parent: testDevice as TestDevice,124 childId: key,125 }) as MarkRequired<TestDevice, 'getDevice' | 'childId' | 'parent'>;126 });127 })();128 } else {129 testDevice.getOtherChildren = function getOtherChildren(): MarkRequired<130 TestDevice,131 'getDevice' | 'childId' | 'parent'132 >[] {133 if (!(parent !== undefined && parent.children !== undefined))134 throw new TypeError();135 return parent.children.filter((oc) => oc.childId !== this.childId);136 };137 testDevice.getOtherChildrenState =138 async function getOtherChildrenState(): Promise<139 Array<{140 childId: string;141 relayState: boolean;142 alias: string;143 }>144 > {145 if (146 !(147 'getOtherChildren' in testDevice &&148 testDevice.getOtherChildren !== undefined149 )150 ) {151 throw new Error();152 }153 return Promise.all(154 testDevice.getOtherChildren().map(async (childDevice) => {155 const d = (await childDevice.getDevice()) as Plug;156 if (d.childId === undefined) throw new TypeError();157 return {158 childId: d.childId,159 relayState: d.relayState,160 alias: d.alias,161 };162 })163 );164 };165 }166 }167 }168 testDevices.push(testDevice as TestDevice);169 return testDevice as TestDevice;...
WIRENBOARD.js
Source:WIRENBOARD.js
1// Unit: MQTT2//Control3IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("MQTT"), function(name, value){4 switch (name) {5 case "OfficeVentStatus": //ÐенÑилÑÑÐ¸Ñ Ð² подÑобке оÑиÑа (OH Control)6 if(value == false){7 IR.GetDevice("Mix23 (stend)").Set("Relay Channel 06 Switch Off", 0);8 break;9 }else{10 IR.GetDevice("Mix23 (stend)").Set("Relay Channel 06 Switch On", 0);11 break;12 }13 case "LeftRollerShutterStatus": // ÐÐµÐ²Ð°Ñ ÑÑоÑа(OH Control)14 if(value == "UP"){//UP15 IR.GetDevice("Relay 3-channel").Set("Channel 01 Switch On", true);16 break;17 }else if(value == "DOWN"){//DOWN18 IR.GetDevice("Relay 3-channel").Set("Channel 02 Switch On", true);19 break;20 }else{//STOP21 IR.Log("STOP");22 IR.GetDevice("Relay 3-channel").Set("Channel 01 Switch Off", false);23 IR.GetDevice("Relay 3-channel").Set("Channel 02 Switch Off", false);24 break;25 }26 case "CentralRollerShutterStatus": // ЦенÑÑалÑÐ½Ð°Ñ ÑÑоÑа(OH Control)27 if(value == "UP"){//UP28 IR.GetDevice("Relay 2-channel2").Set("Channel 01 Switch On", true);29 break;30 }else if(value == "DOWN"){//DOWN31 IR.GetDevice("Relay 2-channel2").Set("Channel 02 Switch On", true);32 break;33 }else{//STOP34 IR.Log("STOP");35 IR.GetDevice("Relay 2-channel2").Set("Channel 01 Switch Off", false);36 IR.GetDevice("Relay 2-channel2").Set("Channel 02 Switch Off", false);37 break;38 }39 case "RightlRollerShutterStatus": // ÐÑÐ°Ð²Ð°Ñ ÑÑоÑа(OH Control)40 if(value == "UP"){//UP41 IR.GetDevice("Relay 2-channel1").Set("Channel 02 Switch On", true);42 break;43 }else if(value == "DOWN"){//DOWN44 IR.GetDevice("Relay 2-channel1").Set("Channel 01 Switch On", true);45 break;46 }else{//STOP47 IR.Log("STOP");48 IR.GetDevice("Relay 2-channel1").Set("Channel 02 Switch Off", false);49 IR.GetDevice("Relay 2-channel1").Set("Channel 01 Switch Off", false);50 break;51 }52 case "OfficeLampStatus"://Ð¡Ð²ÐµÑ Ð² главной комнаÑе оÑиÑа (OH Control)53 if(value == false){54 IR.GetDevice("Mix23").Set("Relay Channel 09 Switch Off", 0);55 break;56 }else{57 IR.GetDevice("Mix23").Set("Relay Channel 09 Switch On", 0);58 break;59 }60 case "OfficeLamp2Status": //Ð¡Ð²ÐµÑ Ð² подÑобке оÑиÑа (OH Control)61 if(value == false){62 IR.GetDevice("Mix23").Set("Relay Channel 08 Switch Off", 0);63 break;64 }else{65 IR.GetDevice("Mix23").Set("Relay Channel 08 Switch On", 0);66 break;67 }68 }69});70//Control FB71IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("Mix23 (stend)"), function(name, value){72 switch (name) {73 case "Relay Channel 06": //ÐенÑилÑÑÐ¸Ñ Ð² подÑобке оÑиÑа (OH Control FB)74 if(value){75 IR.GetDevice("MQTT").Set("OfficeVentControl", 1); //on76 break;77 }else{78 IR.GetDevice("MQTT").Set("OfficeVentControl", 0); //off79 break;80 }81 }82});83//Control FB84IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("Relay 3-channel"), function(name, value){85 switch (name) { //LEFT ROLLERSHUTTER86 case "Channel 01": //UP87 IR.Log("UP On = " + value);88 break;89 case "Channel 02": //DOWN90 IR.Log("DOWN On = " + value);91 break;92 }93});94//Control FB95IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("Mix23"), function(name, value){96 switch (name) {97 case "Relay Channel 09": //Ð¡Ð²ÐµÑ Ð² главной комнаÑе оÑиÑа (OH Control FB)98 if(value){99 IR.GetDevice("MQTT").Set("OfficeLampControl", 1); //on100 break;101 }else{102 IR.GetDevice("MQTT").Set("OfficeLampControl", 0); //off103 break;104 }105 case "Relay Channel 08": //Ð¡Ð²ÐµÑ Ð² подÑобке оÑиÑа (OH Control FB)106 if(value){107 IR.GetDevice("MQTT").Set("OfficeLamp2Control", 1); //on108 break;109 }else{110 IR.GetDevice("MQTT").Set("OfficeLamp2Control", 0); //off111 break;112 }113 }...
JVCDriver.js
Source:JVCDriver.js
1var JVCDriver = function() {2 var that = this;3 4 this.powerOn = function() {5 IR.SetTimeout(0, function() {IR.GetDevice("PR").Disconnect();});6 IR.SetTimeout(100, function() {IR.GetDevice("PR").Connect();});7 IR.SetTimeout(200, function() {IR.GetDevice("PR").Send(["PJREQ"]);});8 IR.SetTimeout(300, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x31,0x0A]);});9 IR.SetTimeout(500, function() {IR.GetDevice("PR").Disconnect();});10 IR.SetTimeout(600, function() {IR.GetDevice("PR").Connect();});11 IR.SetTimeout(700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});12 IR.SetTimeout(800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x31,0x0A]);});13 IR.SetTimeout(10500, function() {IR.GetDevice("PR").Disconnect();});14 IR.SetTimeout(10600, function() {IR.GetDevice("PR").Connect();});15 IR.SetTimeout(10700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});16 IR.SetTimeout(10800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x31,0x0A]);});17 IR.SetTimeout(20500, function() {IR.GetDevice("PR").Disconnect();});18 IR.SetTimeout(20600, function() {IR.GetDevice("PR").Connect();});19 IR.SetTimeout(20700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});20 IR.SetTimeout(20800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x31,0x0A]);});21 }22 23 this.powerOff = function() {24 IR.SetTimeout(0, function() {IR.GetDevice("PR").Disconnect();});25 IR.SetTimeout(100, function() {IR.GetDevice("PR").Connect();});26 IR.SetTimeout(200, function() {IR.GetDevice("PR").Send(["PJREQ"]);});27 IR.SetTimeout(300, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x30,0x0A]);});28 IR.SetTimeout(500, function() {IR.GetDevice("PR").Disconnect();});29 IR.SetTimeout(600, function() {IR.GetDevice("PR").Connect();});30 IR.SetTimeout(700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});31 IR.SetTimeout(800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x30,0x0A]);});32 IR.SetTimeout(10500, function() {IR.GetDevice("PR").Disconnect();});33 IR.SetTimeout(10600, function() {IR.GetDevice("PR").Connect();});34 IR.SetTimeout(10700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});35 IR.SetTimeout(10800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x30,0x0A]);});36 IR.SetTimeout(20500, function() {IR.GetDevice("PR").Disconnect();});37 IR.SetTimeout(20600, function() {IR.GetDevice("PR").Connect();});38 IR.SetTimeout(20700, function() {IR.GetDevice("PR").Send(["PJREQ"]);});39 IR.SetTimeout(20800, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x50,0x57,0x30,0x0A]);});40 }41 42 this.aspect = function() {43 IR.SetTimeout(0, function() {IR.GetDevice("PR").Disconnect();});44 IR.SetTimeout(100, function() {IR.GetDevice("PR").Connect();});45 IR.SetTimeout(200, function() {IR.GetDevice("PR").Send(["PJREQ"]);});46 IR.SetTimeout(300, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x52,0x43,0x37,0x33,0x37,0x37,0x0A]);});47 }48 49 this.on3d_auto = function() {50 IR.SetTimeout(0, function() {IR.GetDevice("PR").Disconnect();});51 IR.SetTimeout(100, function() {IR.GetDevice("PR").Connect();});52 IR.SetTimeout(200, function() {IR.GetDevice("PR").Send(["PJREQ"]);});53 IR.SetTimeout(300, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x49,0x53,0x33,0x44,0x31,0x0A]);});54 }55 56 this.on3d_off = function() {57 IR.SetTimeout(0, function() {IR.GetDevice("PR").Disconnect();});58 IR.SetTimeout(100, function() {IR.GetDevice("PR").Connect();});59 IR.SetTimeout(200, function() {IR.GetDevice("PR").Send(["PJREQ"]);});60 IR.SetTimeout(300, function() {IR.GetDevice("PR").Send([0x21,0x89,0x01,0x49,0x53,0x33,0x44,0x30,0x0A]);});61 }62 63 /*IR.AddListener(IR.EVENT_RECEIVE_TEXT, IR.GetDevice("PR"), function(text) {64 IR.Log("from pr: " + text);65 });*/...
Using AI Code Generation
1var wptools = require('wptools');2var wp = wptools.page('Barack Obama');3wp.getDevice(function(err, device) {4 if (err) {5 console.log(err);6 } else {7 console.log(device);8 }9});10var wptools = require('wptools');11var wp = wptools.page('Barack Obama');12wp.getLanguage(function(err, language) {13 if (err) {14 console.log(err);15 } else {16 console.log(language);17 }18});19var wptools = require('wptools');20var wp = wptools.page('Barack Obama');21wp.getCoordinates(function(err, coordinates) {22 if (err) {23 console.log(err);24 } else {25 console.log(coordinates);26 }27});28var wptools = require('wptools');29var wp = wptools.page('Barack Obama');30wp.getCoordinates(function(err, coordinates) {31 if (err) {32 console.log(err);33 } else {34 console.log(coordinates);35 }36});37var wptools = require('wptools');38var wp = wptools.page('Barack Obama');39wp.getCoordinates(function(err, coordinates) {40 if (err) {41 console.log(err);42 } else {43 console.log(coordinates);44 }45});46var wptools = require('wptools');47var wp = wptools.page('Barack Obama');48wp.getCoordinates(function(err, coordinates) {49 if (err) {50 console.log(err);51 } else {52 console.log(coordinates);53 }54});
Using AI Code Generation
1var wptools = require('wptools');2var device = wptools.getDevice('Nexus 5');3console.log(device);4var wptools = require('wptools');5var devices = wptools.getDevices();6console.log(devices);7{ width: 360, height: 640, userAgent: 'Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/KRT16M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.105 Mobile Safari/537.36', deviceScaleFactor: 3, mobile: true, touch: true, landscape: false }8{ 'iPhone 5': { width: 320, height: 568, userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1', deviceScaleFactor: 2, mobile: true, touch: true, landscape: false }, 'iPhone 6': { width: 375, height: 667, userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1', deviceScaleFactor: 2, mobile: true, touch: true, landscape: false }, 'iPhone 6 Plus': { width: 414, height: 736, userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1', deviceScaleFactor: 3, mobile: true, touch: true, landscape: false }, 'iPhone 7': { width: 375, height: 667, userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.0 Mobile/14
Using AI Code Generation
1var wptools = require('wptools');2wptools.getDevice('iPhone 4', function(err, device) {3 if (err) {4 console.log('Error: ' + err);5 } else {6 console.log('Device: ' + device);7 }8});9Device: {"name":"iPhone 4","width":320,"height":480,"userAgent":"Mozilla\/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit\/533.17.9 (KHTML, like Gecko) Version\/5.0.2 Mobile\/8J2 Safari\/6533.18.5","pixelRatio":2,"touch":true,"mobile":true}10var wptools = require('wptools');11wptools.getDevices(function(err, devices) {12 if (err) {13 console.log('Error: ' + err);14 } else {15 console.log('Devices: ' + devices);16 }17});18Devices: [{"name":"iPhone 4","width":320,"height":480,"userAgent":"Mozilla\/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit\/533.17.9 (KHTML, like Gecko) Version\/5.0.2 Mobile\/8J2 Safari\/6533.18.5","pixelRatio":2,"touch":true,"mobile":true},...]
Using AI Code Generation
1var wptoolkit = require('wptoolkit');2wptoolkit.getDevice('WP8', function(error, device) {3if (error) {4console.log(error);5} else {6console.log(device);7}8});9{ platform: 'WP8',10 serial: 'xxxxxxxxxxxxxxxx' }11: The device platform (WP8 or WP8.1)12: The device name (Lumia 1020, Nokia Lumia 625, etc.)13: The device OS version (8.10.14193.341, 8.10.14193.341, etc.)14: The device OS (Windows Phone 8.10, Windows Phone 8.10, etc.)15: The device manufacturer (Nokia, Nokia, etc.)16: The device model (RM-877, RM-846, etc.)17: The device UUID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)18: The device platform (wp8, wp8, etc.)19: The device OS version (8.10.14193.341, 8.10.14193.341, etc.)20: The device manufacturer (Nokia, Nokia, etc.)21: Specifies if the device is a virtual device or not (true, false)
Using AI Code Generation
1var wptools = require('wptools');2var device = wptools.getDevice('iPhone 5');3console.log(device);4{ width: 320,5 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53' }6var wptools = require('wptools');7var device = wptools.getDevice('iPhone 5');8 if (err) {9 console.log(err);10 } else {11 console.log('Screenshot saved to google.com.png');12 }13});14var wptools = require('wptools');15var device = wptools.getDevice('iPhone 5');16 if (err) {17 console.log(err);18 } else {19 console.log('Screenshot saved to google.com.png');20 }21});22var wptools = require('wptools');23var device = {24 userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.3.18 (KHTML, like Gecko) Version/8.0.3 Safari/600.3.18'25};26 if (err) {27 console.log(err);28 } else {29 console.log('Screenshot saved to google.com.png');30 }31});32var wptools = require('wptools');33var device = 'width=1024&height=768&userAgent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.3.18 (KHTML, like Gecko) Version/8.0.3 Safari/600.3
Using AI Code Generation
1var wptools = require('wptools');2var wp = wptools('Steve Jobs');3wp.getDevice(function(err,device){4 if(err){5 console.log(err);6 }7 else{8 console.log(device);9 }10});11var wptools = require('wptools');12var wp = wptools('Steve Jobs');13wp.getDevice(function(err,device){14 if(err){15 console.log(err);16 }17 else{18 console.log(device);19 }20});21var wptools = require('wptools');22var wp = wptools('Steve Jobs');23wp.getDevice(function(err,device){24 if(err){25 console.log(err);26 }27 else{28 console.log(device);29 }30});31var wptools = require('wptools');32var wp = wptools('Steve Jobs');33wp.getDevice(function(err,device){34 if(err){35 console.log(err);36 }37 else{38 console.log(device);39 }40});41var wptools = require('wptools');42var wp = wptools('Steve Jobs');43wp.getDevice(function(err,device){44 if(err){45 console.log(err);46 }47 else{48 console.log(device);49 }50});51var wptools = require('wptools');52var wp = wptools('Steve Jobs');
Using AI Code Generation
1var wptools = require('wptools');2var device = wptools.getDevice('iphone6');3console.log(device);4var wptools = require('wptools');5var device = wptools.getDevice('ipad');6console.log(device);7var wptools = require('wptools');8var device = wptools.getDevice('ipad-landscape');9console.log(device);10var wptools = require('wptools');11var device = wptools.getDevice('ipad-pro');12console.log(device);13var wptools = require('wptools');14var device = wptools.getDevice('ipad-mini');15console.log(device);16var wptools = require('wptools');17var device = wptools.getDevice('ipad-mini-landscape');18console.log(device);19var wptools = require('wptools');20var device = wptools.getDevice('galaxys5');
Using AI Code Generation
1var wptools = require('wptools');2var device = wptools.getDevice('iphone 5s');3console.log(device);4console.log(device.width);5console.log(device.height);6console.log(device.density);7{ width: 320, height: 568, density: 2 }8var device = wptools.getDevice('Samsung Galaxy S7');9console.log(device.width);10console.log(device.height);11console.log(device.density);12var device = wptools.getDevice('Samsung Galaxy S7');13console.log(device['width']);14console.log(device['height']);15console.log(device['density']);16var device = wptools.getDevice('Samsung Galaxy S7');17console.log(device.width);18console.log(device.height);19console.log(device.density);20var device = wptools.getDevice('Samsung Galaxy S7');21console.log(device.width);22console.log(device.height);23console.log(device.density);24var device = wptools.getDevice('Samsung Galaxy S7');
Using AI Code Generation
1var wptools = require('wptools');2wptools.getDevice(function(device){3 console.log(device);4});5{ 6 networkInterfaces: { lo: [Object] } 7}8var wptools = require('wptools');9wptools.getOS(function(os){10 console.log(os);11});12{ 13 networkInterfaces: { lo: [Object] } 14}15var wptools = require('wptools');16wptools.getNetworkInterfaces(function(networkInterfaces){17 console.log(networkInterfaces);18});19{ lo: 20 [ { address: '
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!!