Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
at main 1.1 kB view raw
1<!doctype html> 2<html lang="en"> 3 <head> 4 <meta charset="UTF-8" /> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 6 <title>Update Todo</title> 7 <script> 8 window.process = { env: { NODE_ENV: 'development' } }; 9 </script> 10 </head> 11 12 <body> 13 <div id="root"></div> 14 <script type="module"> 15 import urqlClient from './urqlClient.js'; 16 import * as bench from '/bench.js'; 17 import { makeEntries } from './makeEntries.js'; 18 import { makeTodo } from './entities.js'; 19 import { getAllTodos, addTodos, updateTodo } from './benchmarks.js'; 20 21 // create todos to be added/written 22 const hundredTodos = makeEntries(100, makeTodo); 23 24 const benchmark = async () => { 25 await addTodos(hundredTodos); 26 // measure how long update of last Todo entity takes on faux server-side (executeExchange) & cache 27 bench.start(); 28 await updateTodo({ id: '99', complete: true }); 29 bench.stop(); 30 }; 31 32 benchmark(); 33 </script> 34 </body> 35</html>