How to use updateMutableSource method in Playwright Internal

Best JavaScript code snippet using playwright-internal

ReactFiberHooks.new.js

Source:ReactFiberHooks.new.js Github

copy

Full Screen

...2048 subscribe ,2049 ) {2050 currentHookNameInDev = 'useMutableSource';2051 updateHookTypesDev();2052 return updateMutableSource(source, getSnapshot, subscribe);2053 },2054 useOpaqueIdentifier() {2055 currentHookNameInDev = 'useOpaqueIdentifier';2056 updateHookTypesDev();2057 return updateOpaqueIdentifier();2058 },2059 unstable_isNewReconciler: enableNewReconciler,2060 };2061 HooksDispatcherOnRerenderInDEV = {2062 readContext (2063 context ,2064 observedBits ,2065 ) {2066 return readContext(context, observedBits);2067 },2068 useCallback (callback , deps ) {2069 currentHookNameInDev = 'useCallback';2070 updateHookTypesDev();2071 return updateCallback(callback, deps);2072 },2073 useContext (2074 context ,2075 observedBits ,2076 ) {2077 currentHookNameInDev = 'useContext';2078 updateHookTypesDev();2079 return readContext(context, observedBits);2080 },2081 useEffect(2082 create ,2083 deps ,2084 ) {2085 currentHookNameInDev = 'useEffect';2086 updateHookTypesDev();2087 return updateEffect(create, deps);2088 },2089 useImperativeHandle (2090 ref ,2091 create ,2092 deps ,2093 ) {2094 currentHookNameInDev = 'useImperativeHandle';2095 updateHookTypesDev();2096 return updateImperativeHandle(ref, create, deps);2097 },2098 useLayoutEffect(2099 create ,2100 deps ,2101 ) {2102 currentHookNameInDev = 'useLayoutEffect';2103 updateHookTypesDev();2104 return updateLayoutEffect(create, deps);2105 },2106 useMemo (create , deps ) {2107 currentHookNameInDev = 'useMemo';2108 updateHookTypesDev();2109 const prevDispatcher = ReactCurrentDispatcher.current;2110 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;2111 try {2112 return updateMemo(create, deps);2113 } finally {2114 ReactCurrentDispatcher.current = prevDispatcher;2115 }2116 },2117 useReducer (2118 reducer ,2119 initialArg ,2120 init ,2121 ) {2122 currentHookNameInDev = 'useReducer';2123 updateHookTypesDev();2124 const prevDispatcher = ReactCurrentDispatcher.current;2125 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;2126 try {2127 return rerenderReducer(reducer, initialArg, init);2128 } finally {2129 ReactCurrentDispatcher.current = prevDispatcher;2130 }2131 },2132 useRef (initialValue ) {2133 currentHookNameInDev = 'useRef';2134 updateHookTypesDev();2135 return updateRef(initialValue);2136 },2137 useState (2138 initialState ,2139 ) {2140 currentHookNameInDev = 'useState';2141 updateHookTypesDev();2142 const prevDispatcher = ReactCurrentDispatcher.current;2143 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;2144 try {2145 return rerenderState(initialState);2146 } finally {2147 ReactCurrentDispatcher.current = prevDispatcher;2148 }2149 },2150 useDebugValue (value , formatterFn ) {2151 currentHookNameInDev = 'useDebugValue';2152 updateHookTypesDev();2153 return updateDebugValue(value, formatterFn);2154 },2155 useDeferredValue (value ) {2156 currentHookNameInDev = 'useDeferredValue';2157 updateHookTypesDev();2158 return rerenderDeferredValue(value);2159 },2160 useTransition() {2161 currentHookNameInDev = 'useTransition';2162 updateHookTypesDev();2163 return rerenderTransition();2164 },2165 useMutableSource (2166 source ,2167 getSnapshot ,2168 subscribe ,2169 ) {2170 currentHookNameInDev = 'useMutableSource';2171 updateHookTypesDev();2172 return updateMutableSource(source, getSnapshot, subscribe);2173 },2174 useOpaqueIdentifier() {2175 currentHookNameInDev = 'useOpaqueIdentifier';2176 updateHookTypesDev();2177 return rerenderOpaqueIdentifier();2178 },2179 unstable_isNewReconciler: enableNewReconciler,2180 };2181 InvalidNestedHooksDispatcherOnMountInDEV = {2182 readContext (2183 context ,2184 observedBits ,2185 ) {2186 warnInvalidContextAccess();2187 return readContext(context, observedBits);2188 },2189 useCallback (callback , deps ) {2190 currentHookNameInDev = 'useCallback';2191 warnInvalidHookAccess();2192 mountHookTypesDev();2193 return mountCallback(callback, deps);2194 },2195 useContext (2196 context ,2197 observedBits ,2198 ) {2199 currentHookNameInDev = 'useContext';2200 warnInvalidHookAccess();2201 mountHookTypesDev();2202 return readContext(context, observedBits);2203 },2204 useEffect(2205 create ,2206 deps ,2207 ) {2208 currentHookNameInDev = 'useEffect';2209 warnInvalidHookAccess();2210 mountHookTypesDev();2211 return mountEffect(create, deps);2212 },2213 useImperativeHandle (2214 ref ,2215 create ,2216 deps ,2217 ) {2218 currentHookNameInDev = 'useImperativeHandle';2219 warnInvalidHookAccess();2220 mountHookTypesDev();2221 return mountImperativeHandle(ref, create, deps);2222 },2223 useLayoutEffect(2224 create ,2225 deps ,2226 ) {2227 currentHookNameInDev = 'useLayoutEffect';2228 warnInvalidHookAccess();2229 mountHookTypesDev();2230 return mountLayoutEffect(create, deps);2231 },2232 useMemo (create , deps ) {2233 currentHookNameInDev = 'useMemo';2234 warnInvalidHookAccess();2235 mountHookTypesDev();2236 const prevDispatcher = ReactCurrentDispatcher.current;2237 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;2238 try {2239 return mountMemo(create, deps);2240 } finally {2241 ReactCurrentDispatcher.current = prevDispatcher;2242 }2243 },2244 useReducer (2245 reducer ,2246 initialArg ,2247 init ,2248 ) {2249 currentHookNameInDev = 'useReducer';2250 warnInvalidHookAccess();2251 mountHookTypesDev();2252 const prevDispatcher = ReactCurrentDispatcher.current;2253 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;2254 try {2255 return mountReducer(reducer, initialArg, init);2256 } finally {2257 ReactCurrentDispatcher.current = prevDispatcher;2258 }2259 },2260 useRef (initialValue ) {2261 currentHookNameInDev = 'useRef';2262 warnInvalidHookAccess();2263 mountHookTypesDev();2264 return mountRef(initialValue);2265 },2266 useState (2267 initialState ,2268 ) {2269 currentHookNameInDev = 'useState';2270 warnInvalidHookAccess();2271 mountHookTypesDev();2272 const prevDispatcher = ReactCurrentDispatcher.current;2273 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;2274 try {2275 return mountState(initialState);2276 } finally {2277 ReactCurrentDispatcher.current = prevDispatcher;2278 }2279 },2280 useDebugValue (value , formatterFn ) {2281 currentHookNameInDev = 'useDebugValue';2282 warnInvalidHookAccess();2283 mountHookTypesDev();2284 return mountDebugValue(value, formatterFn);2285 },2286 useDeferredValue (value ) {2287 currentHookNameInDev = 'useDeferredValue';2288 warnInvalidHookAccess();2289 mountHookTypesDev();2290 return mountDeferredValue(value);2291 },2292 useTransition() {2293 currentHookNameInDev = 'useTransition';2294 warnInvalidHookAccess();2295 mountHookTypesDev();2296 return mountTransition();2297 },2298 useMutableSource (2299 source ,2300 getSnapshot ,2301 subscribe ,2302 ) {2303 currentHookNameInDev = 'useMutableSource';2304 warnInvalidHookAccess();2305 mountHookTypesDev();2306 return mountMutableSource(source, getSnapshot, subscribe);2307 },2308 useOpaqueIdentifier() {2309 currentHookNameInDev = 'useOpaqueIdentifier';2310 warnInvalidHookAccess();2311 mountHookTypesDev();2312 return mountOpaqueIdentifier();2313 },2314 unstable_isNewReconciler: enableNewReconciler,2315 };2316 InvalidNestedHooksDispatcherOnUpdateInDEV = {2317 readContext (2318 context ,2319 observedBits ,2320 ) {2321 warnInvalidContextAccess();2322 return readContext(context, observedBits);2323 },2324 useCallback (callback , deps ) {2325 currentHookNameInDev = 'useCallback';2326 warnInvalidHookAccess();2327 updateHookTypesDev();2328 return updateCallback(callback, deps);2329 },2330 useContext (2331 context ,2332 observedBits ,2333 ) {2334 currentHookNameInDev = 'useContext';2335 warnInvalidHookAccess();2336 updateHookTypesDev();2337 return readContext(context, observedBits);2338 },2339 useEffect(2340 create ,2341 deps ,2342 ) {2343 currentHookNameInDev = 'useEffect';2344 warnInvalidHookAccess();2345 updateHookTypesDev();2346 return updateEffect(create, deps);2347 },2348 useImperativeHandle (2349 ref ,2350 create ,2351 deps ,2352 ) {2353 currentHookNameInDev = 'useImperativeHandle';2354 warnInvalidHookAccess();2355 updateHookTypesDev();2356 return updateImperativeHandle(ref, create, deps);2357 },2358 useLayoutEffect(2359 create ,2360 deps ,2361 ) {2362 currentHookNameInDev = 'useLayoutEffect';2363 warnInvalidHookAccess();2364 updateHookTypesDev();2365 return updateLayoutEffect(create, deps);2366 },2367 useMemo (create , deps ) {2368 currentHookNameInDev = 'useMemo';2369 warnInvalidHookAccess();2370 updateHookTypesDev();2371 const prevDispatcher = ReactCurrentDispatcher.current;2372 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2373 try {2374 return updateMemo(create, deps);2375 } finally {2376 ReactCurrentDispatcher.current = prevDispatcher;2377 }2378 },2379 useReducer (2380 reducer ,2381 initialArg ,2382 init ,2383 ) {2384 currentHookNameInDev = 'useReducer';2385 warnInvalidHookAccess();2386 updateHookTypesDev();2387 const prevDispatcher = ReactCurrentDispatcher.current;2388 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2389 try {2390 return updateReducer(reducer, initialArg, init);2391 } finally {2392 ReactCurrentDispatcher.current = prevDispatcher;2393 }2394 },2395 useRef (initialValue ) {2396 currentHookNameInDev = 'useRef';2397 warnInvalidHookAccess();2398 updateHookTypesDev();2399 return updateRef(initialValue);2400 },2401 useState (2402 initialState ,2403 ) {2404 currentHookNameInDev = 'useState';2405 warnInvalidHookAccess();2406 updateHookTypesDev();2407 const prevDispatcher = ReactCurrentDispatcher.current;2408 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2409 try {2410 return updateState(initialState);2411 } finally {2412 ReactCurrentDispatcher.current = prevDispatcher;2413 }2414 },2415 useDebugValue (value , formatterFn ) {2416 currentHookNameInDev = 'useDebugValue';2417 warnInvalidHookAccess();2418 updateHookTypesDev();2419 return updateDebugValue(value, formatterFn);2420 },2421 useDeferredValue (value ) {2422 currentHookNameInDev = 'useDeferredValue';2423 warnInvalidHookAccess();2424 updateHookTypesDev();2425 return updateDeferredValue(value);2426 },2427 useTransition() {2428 currentHookNameInDev = 'useTransition';2429 warnInvalidHookAccess();2430 updateHookTypesDev();2431 return updateTransition();2432 },2433 useMutableSource (2434 source ,2435 getSnapshot ,2436 subscribe ,2437 ) {2438 currentHookNameInDev = 'useMutableSource';2439 warnInvalidHookAccess();2440 updateHookTypesDev();2441 return updateMutableSource(source, getSnapshot, subscribe);2442 },2443 useOpaqueIdentifier() {2444 currentHookNameInDev = 'useOpaqueIdentifier';2445 warnInvalidHookAccess();2446 updateHookTypesDev();2447 return updateOpaqueIdentifier();2448 },2449 unstable_isNewReconciler: enableNewReconciler,2450 };2451 InvalidNestedHooksDispatcherOnRerenderInDEV = {2452 readContext (2453 context ,2454 observedBits ,2455 ) {2456 warnInvalidContextAccess();2457 return readContext(context, observedBits);2458 },2459 useCallback (callback , deps ) {2460 currentHookNameInDev = 'useCallback';2461 warnInvalidHookAccess();2462 updateHookTypesDev();2463 return updateCallback(callback, deps);2464 },2465 useContext (2466 context ,2467 observedBits ,2468 ) {2469 currentHookNameInDev = 'useContext';2470 warnInvalidHookAccess();2471 updateHookTypesDev();2472 return readContext(context, observedBits);2473 },2474 useEffect(2475 create ,2476 deps ,2477 ) {2478 currentHookNameInDev = 'useEffect';2479 warnInvalidHookAccess();2480 updateHookTypesDev();2481 return updateEffect(create, deps);2482 },2483 useImperativeHandle (2484 ref ,2485 create ,2486 deps ,2487 ) {2488 currentHookNameInDev = 'useImperativeHandle';2489 warnInvalidHookAccess();2490 updateHookTypesDev();2491 return updateImperativeHandle(ref, create, deps);2492 },2493 useLayoutEffect(2494 create ,2495 deps ,2496 ) {2497 currentHookNameInDev = 'useLayoutEffect';2498 warnInvalidHookAccess();2499 updateHookTypesDev();2500 return updateLayoutEffect(create, deps);2501 },2502 useMemo (create , deps ) {2503 currentHookNameInDev = 'useMemo';2504 warnInvalidHookAccess();2505 updateHookTypesDev();2506 const prevDispatcher = ReactCurrentDispatcher.current;2507 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2508 try {2509 return updateMemo(create, deps);2510 } finally {2511 ReactCurrentDispatcher.current = prevDispatcher;2512 }2513 },2514 useReducer (2515 reducer ,2516 initialArg ,2517 init ,2518 ) {2519 currentHookNameInDev = 'useReducer';2520 warnInvalidHookAccess();2521 updateHookTypesDev();2522 const prevDispatcher = ReactCurrentDispatcher.current;2523 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2524 try {2525 return rerenderReducer(reducer, initialArg, init);2526 } finally {2527 ReactCurrentDispatcher.current = prevDispatcher;2528 }2529 },2530 useRef (initialValue ) {2531 currentHookNameInDev = 'useRef';2532 warnInvalidHookAccess();2533 updateHookTypesDev();2534 return updateRef(initialValue);2535 },2536 useState (2537 initialState ,2538 ) {2539 currentHookNameInDev = 'useState';2540 warnInvalidHookAccess();2541 updateHookTypesDev();2542 const prevDispatcher = ReactCurrentDispatcher.current;2543 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2544 try {2545 return rerenderState(initialState);2546 } finally {2547 ReactCurrentDispatcher.current = prevDispatcher;2548 }2549 },2550 useDebugValue (value , formatterFn ) {2551 currentHookNameInDev = 'useDebugValue';2552 warnInvalidHookAccess();2553 updateHookTypesDev();2554 return updateDebugValue(value, formatterFn);2555 },2556 useDeferredValue (value ) {2557 currentHookNameInDev = 'useDeferredValue';2558 warnInvalidHookAccess();2559 updateHookTypesDev();2560 return rerenderDeferredValue(value);2561 },2562 useTransition() {2563 currentHookNameInDev = 'useTransition';2564 warnInvalidHookAccess();2565 updateHookTypesDev();2566 return rerenderTransition();2567 },2568 useMutableSource (2569 source ,2570 getSnapshot ,2571 subscribe ,2572 ) {2573 currentHookNameInDev = 'useMutableSource';2574 warnInvalidHookAccess();2575 updateHookTypesDev();2576 return updateMutableSource(source, getSnapshot, subscribe);2577 },2578 useOpaqueIdentifier() {2579 currentHookNameInDev = 'useOpaqueIdentifier';2580 warnInvalidHookAccess();2581 updateHookTypesDev();2582 return rerenderOpaqueIdentifier();2583 },2584 unstable_isNewReconciler: enableNewReconciler,2585 };...

Full Screen

Full Screen

ReactFiberHooks.old.js

Source:ReactFiberHooks.old.js Github

copy

Full Screen

...2008 subscribe ,2009 ) {2010 currentHookNameInDev = 'useMutableSource';2011 updateHookTypesDev();2012 return updateMutableSource(source, getSnapshot, subscribe);2013 },2014 useOpaqueIdentifier() {2015 currentHookNameInDev = 'useOpaqueIdentifier';2016 updateHookTypesDev();2017 return updateOpaqueIdentifier();2018 },2019 unstable_isNewReconciler: enableNewReconciler,2020 };2021 HooksDispatcherOnRerenderInDEV = {2022 readContext (2023 context ,2024 observedBits ,2025 ) {2026 return readContext(context, observedBits);2027 },2028 useCallback (callback , deps ) {2029 currentHookNameInDev = 'useCallback';2030 updateHookTypesDev();2031 return updateCallback(callback, deps);2032 },2033 useContext (2034 context ,2035 observedBits ,2036 ) {2037 currentHookNameInDev = 'useContext';2038 updateHookTypesDev();2039 return readContext(context, observedBits);2040 },2041 useEffect(2042 create ,2043 deps ,2044 ) {2045 currentHookNameInDev = 'useEffect';2046 updateHookTypesDev();2047 return updateEffect(create, deps);2048 },2049 useImperativeHandle (2050 ref ,2051 create ,2052 deps ,2053 ) {2054 currentHookNameInDev = 'useImperativeHandle';2055 updateHookTypesDev();2056 return updateImperativeHandle(ref, create, deps);2057 },2058 useLayoutEffect(2059 create ,2060 deps ,2061 ) {2062 currentHookNameInDev = 'useLayoutEffect';2063 updateHookTypesDev();2064 return updateLayoutEffect(create, deps);2065 },2066 useMemo (create , deps ) {2067 currentHookNameInDev = 'useMemo';2068 updateHookTypesDev();2069 const prevDispatcher = ReactCurrentDispatcher.current;2070 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;2071 try {2072 return updateMemo(create, deps);2073 } finally {2074 ReactCurrentDispatcher.current = prevDispatcher;2075 }2076 },2077 useReducer (2078 reducer ,2079 initialArg ,2080 init ,2081 ) {2082 currentHookNameInDev = 'useReducer';2083 updateHookTypesDev();2084 const prevDispatcher = ReactCurrentDispatcher.current;2085 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;2086 try {2087 return rerenderReducer(reducer, initialArg, init);2088 } finally {2089 ReactCurrentDispatcher.current = prevDispatcher;2090 }2091 },2092 useRef (initialValue ) {2093 currentHookNameInDev = 'useRef';2094 updateHookTypesDev();2095 return updateRef(initialValue);2096 },2097 useState (2098 initialState ,2099 ) {2100 currentHookNameInDev = 'useState';2101 updateHookTypesDev();2102 const prevDispatcher = ReactCurrentDispatcher.current;2103 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;2104 try {2105 return rerenderState(initialState);2106 } finally {2107 ReactCurrentDispatcher.current = prevDispatcher;2108 }2109 },2110 useDebugValue (value , formatterFn ) {2111 currentHookNameInDev = 'useDebugValue';2112 updateHookTypesDev();2113 return updateDebugValue(value, formatterFn);2114 },2115 useDeferredValue (value ) {2116 currentHookNameInDev = 'useDeferredValue';2117 updateHookTypesDev();2118 return rerenderDeferredValue(value);2119 },2120 useTransition() {2121 currentHookNameInDev = 'useTransition';2122 updateHookTypesDev();2123 return rerenderTransition();2124 },2125 useMutableSource (2126 source ,2127 getSnapshot ,2128 subscribe ,2129 ) {2130 currentHookNameInDev = 'useMutableSource';2131 updateHookTypesDev();2132 return updateMutableSource(source, getSnapshot, subscribe);2133 },2134 useOpaqueIdentifier() {2135 currentHookNameInDev = 'useOpaqueIdentifier';2136 updateHookTypesDev();2137 return rerenderOpaqueIdentifier();2138 },2139 unstable_isNewReconciler: enableNewReconciler,2140 };2141 InvalidNestedHooksDispatcherOnMountInDEV = {2142 readContext (2143 context ,2144 observedBits ,2145 ) {2146 warnInvalidContextAccess();2147 return readContext(context, observedBits);2148 },2149 useCallback (callback , deps ) {2150 currentHookNameInDev = 'useCallback';2151 warnInvalidHookAccess();2152 mountHookTypesDev();2153 return mountCallback(callback, deps);2154 },2155 useContext (2156 context ,2157 observedBits ,2158 ) {2159 currentHookNameInDev = 'useContext';2160 warnInvalidHookAccess();2161 mountHookTypesDev();2162 return readContext(context, observedBits);2163 },2164 useEffect(2165 create ,2166 deps ,2167 ) {2168 currentHookNameInDev = 'useEffect';2169 warnInvalidHookAccess();2170 mountHookTypesDev();2171 return mountEffect(create, deps);2172 },2173 useImperativeHandle (2174 ref ,2175 create ,2176 deps ,2177 ) {2178 currentHookNameInDev = 'useImperativeHandle';2179 warnInvalidHookAccess();2180 mountHookTypesDev();2181 return mountImperativeHandle(ref, create, deps);2182 },2183 useLayoutEffect(2184 create ,2185 deps ,2186 ) {2187 currentHookNameInDev = 'useLayoutEffect';2188 warnInvalidHookAccess();2189 mountHookTypesDev();2190 return mountLayoutEffect(create, deps);2191 },2192 useMemo (create , deps ) {2193 currentHookNameInDev = 'useMemo';2194 warnInvalidHookAccess();2195 mountHookTypesDev();2196 const prevDispatcher = ReactCurrentDispatcher.current;2197 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;2198 try {2199 return mountMemo(create, deps);2200 } finally {2201 ReactCurrentDispatcher.current = prevDispatcher;2202 }2203 },2204 useReducer (2205 reducer ,2206 initialArg ,2207 init ,2208 ) {2209 currentHookNameInDev = 'useReducer';2210 warnInvalidHookAccess();2211 mountHookTypesDev();2212 const prevDispatcher = ReactCurrentDispatcher.current;2213 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;2214 try {2215 return mountReducer(reducer, initialArg, init);2216 } finally {2217 ReactCurrentDispatcher.current = prevDispatcher;2218 }2219 },2220 useRef (initialValue ) {2221 currentHookNameInDev = 'useRef';2222 warnInvalidHookAccess();2223 mountHookTypesDev();2224 return mountRef(initialValue);2225 },2226 useState (2227 initialState ,2228 ) {2229 currentHookNameInDev = 'useState';2230 warnInvalidHookAccess();2231 mountHookTypesDev();2232 const prevDispatcher = ReactCurrentDispatcher.current;2233 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;2234 try {2235 return mountState(initialState);2236 } finally {2237 ReactCurrentDispatcher.current = prevDispatcher;2238 }2239 },2240 useDebugValue (value , formatterFn ) {2241 currentHookNameInDev = 'useDebugValue';2242 warnInvalidHookAccess();2243 mountHookTypesDev();2244 return mountDebugValue(value, formatterFn);2245 },2246 useDeferredValue (value ) {2247 currentHookNameInDev = 'useDeferredValue';2248 warnInvalidHookAccess();2249 mountHookTypesDev();2250 return mountDeferredValue(value);2251 },2252 useTransition() {2253 currentHookNameInDev = 'useTransition';2254 warnInvalidHookAccess();2255 mountHookTypesDev();2256 return mountTransition();2257 },2258 useMutableSource (2259 source ,2260 getSnapshot ,2261 subscribe ,2262 ) {2263 currentHookNameInDev = 'useMutableSource';2264 warnInvalidHookAccess();2265 mountHookTypesDev();2266 return mountMutableSource(source, getSnapshot, subscribe);2267 },2268 useOpaqueIdentifier() {2269 currentHookNameInDev = 'useOpaqueIdentifier';2270 warnInvalidHookAccess();2271 mountHookTypesDev();2272 return mountOpaqueIdentifier();2273 },2274 unstable_isNewReconciler: enableNewReconciler,2275 };2276 InvalidNestedHooksDispatcherOnUpdateInDEV = {2277 readContext (2278 context ,2279 observedBits ,2280 ) {2281 warnInvalidContextAccess();2282 return readContext(context, observedBits);2283 },2284 useCallback (callback , deps ) {2285 currentHookNameInDev = 'useCallback';2286 warnInvalidHookAccess();2287 updateHookTypesDev();2288 return updateCallback(callback, deps);2289 },2290 useContext (2291 context ,2292 observedBits ,2293 ) {2294 currentHookNameInDev = 'useContext';2295 warnInvalidHookAccess();2296 updateHookTypesDev();2297 return readContext(context, observedBits);2298 },2299 useEffect(2300 create ,2301 deps ,2302 ) {2303 currentHookNameInDev = 'useEffect';2304 warnInvalidHookAccess();2305 updateHookTypesDev();2306 return updateEffect(create, deps);2307 },2308 useImperativeHandle (2309 ref ,2310 create ,2311 deps ,2312 ) {2313 currentHookNameInDev = 'useImperativeHandle';2314 warnInvalidHookAccess();2315 updateHookTypesDev();2316 return updateImperativeHandle(ref, create, deps);2317 },2318 useLayoutEffect(2319 create ,2320 deps ,2321 ) {2322 currentHookNameInDev = 'useLayoutEffect';2323 warnInvalidHookAccess();2324 updateHookTypesDev();2325 return updateLayoutEffect(create, deps);2326 },2327 useMemo (create , deps ) {2328 currentHookNameInDev = 'useMemo';2329 warnInvalidHookAccess();2330 updateHookTypesDev();2331 const prevDispatcher = ReactCurrentDispatcher.current;2332 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2333 try {2334 return updateMemo(create, deps);2335 } finally {2336 ReactCurrentDispatcher.current = prevDispatcher;2337 }2338 },2339 useReducer (2340 reducer ,2341 initialArg ,2342 init ,2343 ) {2344 currentHookNameInDev = 'useReducer';2345 warnInvalidHookAccess();2346 updateHookTypesDev();2347 const prevDispatcher = ReactCurrentDispatcher.current;2348 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2349 try {2350 return updateReducer(reducer, initialArg, init);2351 } finally {2352 ReactCurrentDispatcher.current = prevDispatcher;2353 }2354 },2355 useRef (initialValue ) {2356 currentHookNameInDev = 'useRef';2357 warnInvalidHookAccess();2358 updateHookTypesDev();2359 return updateRef(initialValue);2360 },2361 useState (2362 initialState ,2363 ) {2364 currentHookNameInDev = 'useState';2365 warnInvalidHookAccess();2366 updateHookTypesDev();2367 const prevDispatcher = ReactCurrentDispatcher.current;2368 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2369 try {2370 return updateState(initialState);2371 } finally {2372 ReactCurrentDispatcher.current = prevDispatcher;2373 }2374 },2375 useDebugValue (value , formatterFn ) {2376 currentHookNameInDev = 'useDebugValue';2377 warnInvalidHookAccess();2378 updateHookTypesDev();2379 return updateDebugValue(value, formatterFn);2380 },2381 useDeferredValue (value ) {2382 currentHookNameInDev = 'useDeferredValue';2383 warnInvalidHookAccess();2384 updateHookTypesDev();2385 return updateDeferredValue(value);2386 },2387 useTransition() {2388 currentHookNameInDev = 'useTransition';2389 warnInvalidHookAccess();2390 updateHookTypesDev();2391 return updateTransition();2392 },2393 useMutableSource (2394 source ,2395 getSnapshot ,2396 subscribe ,2397 ) {2398 currentHookNameInDev = 'useMutableSource';2399 warnInvalidHookAccess();2400 updateHookTypesDev();2401 return updateMutableSource(source, getSnapshot, subscribe);2402 },2403 useOpaqueIdentifier() {2404 currentHookNameInDev = 'useOpaqueIdentifier';2405 warnInvalidHookAccess();2406 updateHookTypesDev();2407 return updateOpaqueIdentifier();2408 },2409 unstable_isNewReconciler: enableNewReconciler,2410 };2411 InvalidNestedHooksDispatcherOnRerenderInDEV = {2412 readContext (2413 context ,2414 observedBits ,2415 ) {2416 warnInvalidContextAccess();2417 return readContext(context, observedBits);2418 },2419 useCallback (callback , deps ) {2420 currentHookNameInDev = 'useCallback';2421 warnInvalidHookAccess();2422 updateHookTypesDev();2423 return updateCallback(callback, deps);2424 },2425 useContext (2426 context ,2427 observedBits ,2428 ) {2429 currentHookNameInDev = 'useContext';2430 warnInvalidHookAccess();2431 updateHookTypesDev();2432 return readContext(context, observedBits);2433 },2434 useEffect(2435 create ,2436 deps ,2437 ) {2438 currentHookNameInDev = 'useEffect';2439 warnInvalidHookAccess();2440 updateHookTypesDev();2441 return updateEffect(create, deps);2442 },2443 useImperativeHandle (2444 ref ,2445 create ,2446 deps ,2447 ) {2448 currentHookNameInDev = 'useImperativeHandle';2449 warnInvalidHookAccess();2450 updateHookTypesDev();2451 return updateImperativeHandle(ref, create, deps);2452 },2453 useLayoutEffect(2454 create ,2455 deps ,2456 ) {2457 currentHookNameInDev = 'useLayoutEffect';2458 warnInvalidHookAccess();2459 updateHookTypesDev();2460 return updateLayoutEffect(create, deps);2461 },2462 useMemo (create , deps ) {2463 currentHookNameInDev = 'useMemo';2464 warnInvalidHookAccess();2465 updateHookTypesDev();2466 const prevDispatcher = ReactCurrentDispatcher.current;2467 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2468 try {2469 return updateMemo(create, deps);2470 } finally {2471 ReactCurrentDispatcher.current = prevDispatcher;2472 }2473 },2474 useReducer (2475 reducer ,2476 initialArg ,2477 init ,2478 ) {2479 currentHookNameInDev = 'useReducer';2480 warnInvalidHookAccess();2481 updateHookTypesDev();2482 const prevDispatcher = ReactCurrentDispatcher.current;2483 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2484 try {2485 return rerenderReducer(reducer, initialArg, init);2486 } finally {2487 ReactCurrentDispatcher.current = prevDispatcher;2488 }2489 },2490 useRef (initialValue ) {2491 currentHookNameInDev = 'useRef';2492 warnInvalidHookAccess();2493 updateHookTypesDev();2494 return updateRef(initialValue);2495 },2496 useState (2497 initialState ,2498 ) {2499 currentHookNameInDev = 'useState';2500 warnInvalidHookAccess();2501 updateHookTypesDev();2502 const prevDispatcher = ReactCurrentDispatcher.current;2503 ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;2504 try {2505 return rerenderState(initialState);2506 } finally {2507 ReactCurrentDispatcher.current = prevDispatcher;2508 }2509 },2510 useDebugValue (value , formatterFn ) {2511 currentHookNameInDev = 'useDebugValue';2512 warnInvalidHookAccess();2513 updateHookTypesDev();2514 return updateDebugValue(value, formatterFn);2515 },2516 useDeferredValue (value ) {2517 currentHookNameInDev = 'useDeferredValue';2518 warnInvalidHookAccess();2519 updateHookTypesDev();2520 return rerenderDeferredValue(value);2521 },2522 useTransition() {2523 currentHookNameInDev = 'useTransition';2524 warnInvalidHookAccess();2525 updateHookTypesDev();2526 return rerenderTransition();2527 },2528 useMutableSource (2529 source ,2530 getSnapshot ,2531 subscribe ,2532 ) {2533 currentHookNameInDev = 'useMutableSource';2534 warnInvalidHookAccess();2535 updateHookTypesDev();2536 return updateMutableSource(source, getSnapshot, subscribe);2537 },2538 useOpaqueIdentifier() {2539 currentHookNameInDev = 'useOpaqueIdentifier';2540 warnInvalidHookAccess();2541 updateHookTypesDev();2542 return rerenderOpaqueIdentifier();2543 },2544 unstable_isNewReconciler: enableNewReconciler,2545 };...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

1const express = require('express')2const bodyParser = require('body-parser')3const multer = require('multer')4const config = require('./config')5const initSSE = require('./sse').initSSE6const cache = require('./cache')7const setupAppMiddleware = require('./app-middleware')8const cors = require('cors')9/*10var whitelist = ['http://localhost:7777', 'http://localhost:3000']11var corsOptions = {12 origin: function (origin, callback) {13 if (!origin || whitelist.indexOf(origin) !== -1) {14 callback(null, true)15 } else {16 callback(new Error('Not allowed by CORS: ' + origin))17 }18 }19}20*/21const views = {22 index: require('./views/index'),23 about: require('./views/about'),24 browse: require('./views/browse'),25 login: require('./views/login'),26 logout: require('./views/logout'),27 register: require('./views/register'),28 resetPassword: require('./views/resetPassword'),29 profile: require('./views/profile'),30 search: require('./views/search'),31 advancedSearch: require('./views/advancedSearch'),32 submit: require('./views/submit'),33 manage: require('./views/manage'),34 topLevel: require('./views/topLevel'),35 persistentIdentity: require('./views/persistentIdentity'),36 setup: require('./views/setup'),37 dataIntegration: require('./views/dataIntegration'),38 jobs: require('./views/jobs'),39 sparql: require('./views/sparql'),40 addOwner: require('./views/addOwner'),41 shared: require('./views/shared'),42 visualization: require('./views/visualization'),43 logo: require('./views/logo'),44 stream: require('./views/stream'),45 sbsearch: require('./views/sbsearch'),46 addToCollection: require('./views/addToCollection'),47 admin: {48 explorer: require('./views/admin/explorer'),49 status: require('./views/admin/status'),50 graphs: require('./views/admin/graphs'),51 sparql: require('./views/admin/sparql'),52 remotes: require('./views/admin/remotes'),53 users: require('./views/admin/users'),54 newUser: require('./views/admin/newUser'),55 jobs: require('./views/admin/jobs'),56 theme: require('./views/admin/theme'),57 // backup: require('./views/admin/backup'),58 // backupRestore: require('./views/admin/backupRestore'),59 registries: require('./views/admin/registries'),60 mail: require('./views/admin/mail'),61 log: require('./views/admin/log'),62 plugins: require('./views/admin/plugins')63 }64}65const api = {66 search: require('./api/search'),67 sbol: require('./api/sbol'),68 sbolnr: require('./api/sbolnr'),69 omex: require('./api/omex'),70 persistentIdentity: require('./api/persistentIdentity'),71 summary: require('./api/summary'),72 fasta: require('./api/fasta'),73 genBank: require('./api/genBank'),74 gff3: require('./api/gff3'),75 metadata: require('./api/metadata'),76 autocomplete: require('./api/autocomplete'),77 count: require('./api/count'),78 healthCheck: require('./api/healthCheck'),79 rootCollections: require('./api/rootCollections'),80 subCollections: require('./api/subCollections'),81 download: require('./api/download'),82 datatables: require('./api/datatables'),83 sparql: require('./api/sparql'),84 stream: require('./api/stream'),85 updateWebOfRegistries: require('./api/updateWebOfRegistries'),86 editObject: require('./api/editObject'),87 addObject: require('./api/addObject'),88 removeObject: require('./api/removeObject'),89 attachUrl: require('./api/attachUrl'),90 expose: require('./api/expose').serveExpose,91 admin: {92 sparql: require('./api/admin/sparql')93 }94}95const actions = {96 makePublic: require('./actions/makePublic'),97 copyFromRemote: require('./actions/copyFromRemote'),98 createBenchlingSequence: require('./actions/createBenchlingSequence'),99 createICEPart: require('./actions/createICEPart'),100 removeCollection: require('./actions/removeCollection'),101 resetPassword: require('./actions/resetPassword'),102 setNewPassword: require('./actions/setNewPassword'),103 remove: require('./actions/remove'),104 removeMembership: require('./actions/removeMembership'),105 replace: require('./actions/replace'),106 createImplementation: require('./actions/createImplementation'),107 createTest: require('./actions/createTest'),108 updateMutableDescription: require('./actions/updateMutableDescription'),109 updateMutableNotes: require('./actions/updateMutableNotes'),110 updateMutableSource: require('./actions/updateMutableSource'),111 updateCitations: require('./actions/updateCitations'),112 cancelJob: require('./actions/cancelJob'),113 restartJob: require('./actions/restartJob'),114 upload: require('./actions/upload'),115 createSnapshot: require('./actions/createSnapshot'),116 updateCollectionIcon: require('./actions/updateCollectionIcon'),117 removeOwner: require('./actions/removeOwnedBy'),118 admin: {119 saveRemote: require('./actions/admin/saveRemote'),120 saveRegistry: require('./actions/admin/saveRegistry'),121 deleteRegistry: require('./actions/admin/deleteRegistry'),122 savePlugin: require('./actions/admin/savePlugin'),123 deletePlugin: require('./actions/admin/deletePlugin'),124 deleteRemote: require('./actions/admin/deleteRemote'),125 updateUser: require('./actions/admin/updateUser'),126 deleteUser: require('./actions/admin/deleteUser'),127 federate: require('./actions/admin/federate'),128 retrieve: require('./actions/admin/retrieveFromWoR'),129 explorerUpdateIndex: require('./actions/admin/explorerUpdateIndex'),130 setAdministratorEmail: require('./actions/admin/updateAdministratorEmail'),131 explorerLog: require('./actions/admin/explorerLog'),132 explorerIndexingLog: require('./actions/admin/explorerIndexingLog')133 }134}135function App () {136 const app = express()137 setupAppMiddleware(app)138 // use cors139 app.use(cors())140 const uploadToMemory = multer({141 storage: multer.memoryStorage({})142 })143 initSSE(app)144 // Data integration experimental endpoints created by James McLaughlin145 if (config.get('experimental').dataIntegration) {146 app.get('/jobs', requireUser, views.jobs)147 app.post('/actions/job/cancel', requireUser, actions.cancelJob)148 app.post('/actions/job/restart', requireUser, actions.restartJob)149 app.get('/admin/jobs', requireAdmin, views.admin.jobs)150 app.all('/user/:userId/:collectionId/:displayId/:version([^\\.]+)/integrate', requireUser, views.dataIntegration)151 app.all('/public/:collectionId/:displayId/:version([^\\.]+)/integrate', views.dataIntegration)152 app.get('/user/:userId/:collectionId/:displayId/:version/createImplementation', requireUser, actions.createImplementation)153 app.get('/user/:userId/:collectionId/:displayId/:version/createTest', requireUser, actions.createTest)154 // TODO: need to decide if createSnapshot is functional and should be kept or not155 app.get('/public/:collectionId/:displayId/:version/createSnapshot', actions.createSnapshot)156 }157 app.get('/', views.index)158 app.get('/about', views.about)159 if (config.get('firstLaunch')) {160 app.get('/setup', views.setup)161 app.post('/setup', uploadToMemory.single('logo'), views.setup)162 }163 app.all('/browse', views.browse)164 function forceNoHTML (req, res, next) { // User Endpoints165 req.forceNoHTML = true166 next()167 }168 // User Endpoints169 if (config.get('allowPublicSignup')) {170 app.all('/register', views.register)171 }172 app.all('/login', views.login)173 app.post('/remoteLogin', forceNoHTML, views.login)174 app.all('/logout', views.logout)175 app.all('/resetPassword/token/:token', actions.resetPassword)176 app.all('/resetPassword', views.resetPassword)177 app.post('/setNewPassword', actions.setNewPassword)178 app.all('/profile', requireUser, views.profile)179 // Misc. Endpoints180 app.get('/logo*', views.logo)181 app.get('/autocomplete/:query', api.autocomplete)182 app.get('/api/datatables', bodyParser.urlencoded({ extended: true }), api.datatables)183 // Plugin Endpoints184 app.get('/stream/:id', views.stream)185 app.get('/api/stream/:id', api.stream.serve)186 app.delete('/api/stream/:id', api.stream.serve)187 // Edit Mutable Fields Endpoints188 app.post('/updateMutableDescription', requireUser, actions.updateMutableDescription)189 app.post('/updateMutableNotes', requireUser, actions.updateMutableNotes)190 app.post('/updateMutableSource', requireUser, actions.updateMutableSource)191 app.post('/updateCitations', requireUser, actions.updateCitations)192 app.post('/user/:userId/:collectionId/:displayId/:version/edit/:field', requireUser, api.editObject)193 app.post('/user/:userId/:collectionId/:displayId/:version/add/:field', requireUser, api.addObject)194 app.post('/user/:userId/:collectionId/:displayId/:version/remove/:field', requireUser, api.removeObject)195 // Submission Endpoints196 app.get('/submit/', requireUser, views.submit)197 app.post('/submit/', requireUser, views.submit)198 app.post('/remoteSubmit/', forceNoHTML, /* requireUser, */ views.submit) // Deprecated199 // Administration Endpoints200 app.get('/admin', requireAdmin, views.admin.status)201 app.get('/admin/graphs', requireAdmin, views.admin.graphs)202 app.get('/admin/log', requireAdmin, views.admin.log)203 app.get('/admin/virtuoso', api.healthCheck)204 app.get('/admin/mail', requireAdmin, views.admin.mail)205 app.post('/admin/mail', requireAdmin, bodyParser.urlencoded({ extended: true }), views.admin.mail)206 app.get('/admin/plugins', views.admin.plugins)207 app.post('/admin/savePlugin', requireAdmin, bodyParser.urlencoded({ extended: true }), actions.admin.savePlugin)208 app.post('/admin/deletePlugin', requireAdmin, bodyParser.urlencoded({ extended: true }), actions.admin.deletePlugin)209 app.get('/admin/registries', requireAdmin, views.admin.registries)210 app.post('/admin/saveRegistry', requireAdmin, bodyParser.urlencoded({ extended: true }), actions.admin.saveRegistry)211 app.post('/admin/deleteRegistry', requireAdmin, bodyParser.urlencoded({ extended: true }), actions.admin.deleteRegistry)212 app.post('/admin/setAdministratorEmail', requireAdmin, bodyParser.urlencoded({ extended: true }), actions.admin.setAdministratorEmail)213 app.post('/admin/retrieveFromWebOfRegistries', requireAdmin, actions.admin.retrieve)214 app.post('/admin/federate', requireAdmin, bodyParser.urlencoded({ extended: true }), actions.admin.federate)215 // This endpoint is used by Web-of-Registries to update SynBioHub's list of registries216 app.post('/updateWebOfRegistries', bodyParser.json(), api.updateWebOfRegistries)217 app.get('/admin/remotes', requireAdmin, views.admin.remotes)218 app.post('/admin/saveRemote', requireAdmin, bodyParser.urlencoded({ extended: true }), actions.admin.saveRemote)219 app.post('/admin/deleteRemote', requireAdmin, bodyParser.urlencoded({ extended: true }), actions.admin.deleteRemote)220 app.get('/admin/explorer', requireAdmin, views.admin.explorer)221 app.post('/admin/explorer', requireAdmin, bodyParser.urlencoded({ extended: true }), views.admin.explorer)222 app.post('/admin/explorerUpdateIndex', requireAdmin, actions.admin.explorerUpdateIndex)223 app.all('/admin/explorerLog', requireAdmin, actions.admin.explorerLog)224 app.all('/admin/explorerIndexingLog', requireAdmin, actions.admin.explorerIndexingLog)225 app.get('/admin/sparql', requireAdmin, sparqlAdmin)226 app.post('/admin/sparql', requireAdmin, bodyParser.urlencoded({ extended: true }), sparqlAdmin)227 app.get('/admin/theme', views.admin.theme)228 app.post('/admin/theme', requireAdmin, uploadToMemory.single('logo'), views.admin.theme)229 app.get('/admin/users', requireAdmin, views.admin.users)230 app.post('/admin/users', requireAdmin, views.admin.users)231 app.get('/admin/newUser', requireAdmin, views.admin.newUser)232 app.post('/admin/newUser', requireAdmin, bodyParser.urlencoded({ extended: true }), views.admin.newUser)233 app.post('/admin/updateUser', requireAdmin, bodyParser.urlencoded({ extended: true }), actions.admin.updateUser)234 app.post('/admin/deleteUser', requireAdmin, bodyParser.urlencoded({ extended: true }), actions.admin.deleteUser)235 // Search Endpoints236 app.get('/search/:query?', views.search)237 app.get('/searchCount/:query?', views.search)238 app.get('/remoteSearch/:query?', forceNoHTML, views.search) /// DEPRECATED, use /search239 app.get('/sbsearch', views.sbsearch)240 app.post('/sbsearch', views.sbsearch)241 app.get('/advancedSearch', views.advancedSearch)242 app.post('/advancedSearch', views.advancedSearch)243 app.post('/createCollection', views.advancedSearch)244 app.get('/:type/count', api.count)245 app.get('/rootCollections', api.rootCollections)246 app.get('/manage', requireUser, views.manage)247 app.get('/shared', requireUser, views.shared)248 app.get('/public/:collectionId/:displayId/:version/subCollections', api.subCollections)249 app.get('/public/:collectionId/:displayId/:version/twins', views.search)250 app.get('/public/:collectionId/:displayId/:version/uses', views.search)251 app.get('/public/:collectionId/:displayId/:version/similar', views.search)252 app.get('/user/:userId/:collectionId/:displayId/:version/subCollections', api.subCollections)253 app.get('/user/:userId/:collectionId/:displayId/:version/twins', views.search)254 app.get('/user/:userId/:collectionId/:displayId/:version/uses', views.search)255 app.get('/user/:userId/:collectionId/:displayId/:version/similar', views.search)256 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/subCollections', api.subCollections)257 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/twins', views.search)258 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/uses', views.search)259 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/similar', views.search)260 app.get('/sparql', sparql)261 app.post('/sparql', bodyParser.urlencoded({ extended: true }), sparql)262 // Manage Submissions Endpoints263 app.post('/public/:collectionId/:displayId/:version/icon', requireUser, uploadToMemory.single('collectionIcon'), actions.updateCollectionIcon)264 app.get('/public/:collectionId/:displayId/:version/removeCollection', requireAdmin, actions.removeCollection)265 app.get('/public/:collectionId/:displayId/:version/addToCollection', requireUser, views.addToCollection)266 app.post('/public/:collectionId/:displayId/:version/addToCollection', requireUser, views.addToCollection)267 app.get('/user/:userId/:collectionId/:displayId/:version/removeCollection', requireUser, actions.removeCollection)268 app.get('/user/:userId/:collectionId/:displayId/:version/addToCollection', requireUser, views.addToCollection)269 app.post('/user/:userId/:collectionId/:displayId/:version/addToCollection', requireUser, views.addToCollection)270 app.get('/user/:userId/:collectionId/:displayId/:version/remove', requireUser, actions.remove)271 app.post('/user/:userId/:collectionId/:displayId/:version/removeMembership', requireUser, actions.removeMembership)272 app.get('/user/:userId/:collectionId/:displayId/:version/replace', requireUser, actions.replace)273 app.get('/user/:userId/:collectionId/:displayId/:version/makePublic', requireUser, actions.makePublic)274 app.post('/user/:userId/:collectionId/:displayId/:version/makePublic', requireUser, uploadToMemory.single('file'), actions.makePublic)275 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/remove', actions.remove)276 app.post('/user/:userId/:collectionId/:displayId/:version/:hash/share/removeMembership', actions.removeMembership)277 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/replace', actions.replace)278 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/makePublic', actions.makePublic)279 app.post('/user/:userId/:collectionId/:displayId/:version/:hash/share/makePublic', uploadToMemory.single('file'), actions.makePublic)280 // Remote ICE/Benchling endpoints281 app.get('/public/:collectionId/:displayId/:version/copyFromRemote', requireUser, actions.copyFromRemote)282 app.post('/public/:collectionId/:displayId/:version/copyFromRemote', requireUser, uploadToMemory.single('file'), actions.copyFromRemote)283 app.get('/public/:collectionId/:displayId/:version/createBenchlingSequence', requireUser, actions.createBenchlingSequence)284 app.post('/public/:collectionId/:displayId/:version/createBenchlingSequence', requireUser, uploadToMemory.single('file'), actions.createBenchlingSequence)285 app.get('/public/:collectionId/:displayId/:version/createICEPart', requireUser, actions.createICEPart)286 app.post('/public/:collectionId/:displayId/:version/createICEPart', requireUser, uploadToMemory.single('file'), actions.createICEPart)287 app.get('/user/:userId/:collectionId/:displayId/:version/createBenchlingSequence', requireUser, actions.createBenchlingSequence)288 app.post('/user/:userId/:collectionId/:displayId/:version/createBenchlingSequence', requireUser, uploadToMemory.single('file'), actions.createBenchlingSequence)289 app.get('/user/:userId/:collectionId/:displayId/:version/createICEPart', requireUser, actions.createICEPart)290 app.post('/user/:userId/:collectionId/:displayId/:version/createICEPart', requireUser, uploadToMemory.single('file'), actions.createICEPart)291 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/createBenchlingSequence', actions.createBenchlingSequence)292 app.post('/user/:userId/:collectionId/:displayId/:version/:hash/share/createBenchlingSequence', uploadToMemory.single('file'), actions.createBenchlingSequence)293 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/createICEPart', actions.createICEPart)294 app.post('/user/:userId/:collectionId/:displayId/:version/:hash/share/createICEPart', uploadToMemory.single('file'), actions.createICEPart)295 // Update Permissions Endpoints296 app.get('/public/:collectionId/:displayId/:version/addOwner', requireUser, views.addOwner)297 app.post('/public/:collectionId/:displayId/:version/addOwner', requireUser, views.addOwner)298 app.post('/public/:collectionId/:displayId/:version/removeOwner/:username', requireUser, actions.removeOwner)299 app.get('/user/:userId/:collectionId/:displayId/:version/addOwner', requireUser, views.addOwner)300 app.post('/user/:userId/:collectionId/:displayId/:version/addOwner', requireUser, views.addOwner)301 app.post('/user/:userId/:collectionId/:displayId/:version/removeOwner/:username', requireUser, actions.removeOwner)302 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/addOwner', views.addOwner)303 app.post('/user/:userId/:collectionId/:displayId/:version/:hash/share/addOwner', views.addOwner)304 app.post('/user/:userId/:collectionId/:displayId/:version/:hash/share/removeOwner/:username', actions.removeOwner)305 // Attachment Endpoints306 app.post('/public/:collectionId/:displayId/:version/attach', requireUser, actions.upload)307 app.post('/public/:collectionId/:displayId/:version/attachUrl', requireUser, api.attachUrl)308 app.get('/public/:collectionId/:displayId/:version/download', api.download)309 app.post('/user/:userId/:collectionId/:displayId/:version/attach', requireUser, actions.upload)310 app.post('/user/:userId/:collectionId/:displayId/:version/attachUrl', requireUser, api.attachUrl)311 app.get('/user/:userId/:collectionId/:displayId/:version/download', requireUser, api.download)312 app.post('/user/:userId/:collectionId/:displayId/:version/:hash/share/attach', actions.upload)313 app.post('/user/:userId/:collectionId/:displayId/:version/:hash/share/attachUrl', api.attachUrl)314 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/download', api.download)315 // Download Endpoints316 app.get('/public/:collectionId/:displayId/sbol', api.persistentIdentity)317 app.get('/public/:collectionId/:displayId/sbolnr', api.persistentIdentity)318 app.get('/user/:userId/:collectionId/:displayId/sbol', api.persistentIdentity)319 app.get('/user/:userId/:collectionId/:displayId/sbolnr', api.persistentIdentity)320 app.get('/public/:collectionId/:displayId/:version/sbol', api.sbol)321 app.get('/public/:collectionId/:displayId/:version/sbolnr', api.sbolnr)322 app.get('/public/:collectionId/:displayId/:version/omex', api.omex)323 app.get('/public/:collectionId/:displayId/:version/summary', api.summary)324 app.get('/public/:collectionId/:displayId/:version/fasta', api.fasta)325 app.get('/public/:collectionId/:displayId/:version/gb', api.genBank)326 app.get('/public/:collectionId/:displayId/:version/gff', api.gff3)327 app.get('/public/:collectionId/:displayId/:version/metadata', api.metadata)328 app.get('/user/:userId/:collectionId/:displayId/:version/sbol', api.sbol)329 app.get('/user/:userId/:collectionId/:displayId/:version/sbolnr', api.sbolnr)330 app.get('/user/:userId/:collectionId/:displayId/:version/omex', api.omex)331 app.get('/user/:userId/:collectionId/:displayId/:version/summary', api.summary)332 app.get('/user/:userId/:collectionId/:displayId/:version/fasta', api.fasta)333 app.get('/user/:userId/:collectionId/:displayId/:version/gb', api.genBank)334 app.get('/user/:userId/:collectionId/:displayId/:version/gff', api.gff3)335 app.get('/user/:userId/:collectionId/:displayId/:version/metadata', api.metadata)336 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/sbol', api.sbol)337 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/sbolnr', api.sbolnr)338 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/omex', api.omex)339 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/summary', api.summary)340 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/fasta', api.fasta)341 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/gb', api.genBank)342 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/gff', api.gff3)343 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/metadata', api.metadata)344 app.get('/public/:collectionId/:displayId/:version/visualization', views.visualization)345 app.get('/user/:userId/:collectionId/:displayId/:version/visualization', views.visualization)346 app.get('/user/:userId/:collectionId/:displayId/:version/:hash/share/visualization', views.visualization)347 // View/Download Endpoints348 app.get('/public/:collectionId/:displayId', views.persistentIdentity)349 app.get('/user/:userId/:collectionId/:displayId', views.persistentIdentity)350 app.get('/user/:userId/:collectionId/:displayId(*)/:version/:hash/share/full', views.topLevel)351 app.get('/user/:userId/:collectionId/:displayId(*)/:version/:hash/share', views.topLevel)352 app.post('/user/:userId/:collectionId/:displayId(*)/:version/:hash/share/full', views.topLevel)353 app.post('/user/:userId/:collectionId/:displayId(*)/:version/:hash/share', views.topLevel)354 app.get('/user/:userId/:collectionId/:displayId(*)/:version/full', views.topLevel)355 app.get('/user/:userId/:collectionId/:displayId(*)/:version', views.topLevel)356 app.post('/user/:userId/:collectionId/:displayId(*)/:version/full', views.topLevel)357 app.post('/user/:userId/:collectionId/:displayId(*)/:version', views.topLevel)358 app.get('/public/:collectionId/:displayId(*)/:version/full', views.topLevel)359 app.get('/public/:collectionId/:displayId(*)/:version', views.topLevel)360 app.post('/public/:collectionId/:displayId(*)/:version/full', views.topLevel)361 app.post('/public/:collectionId/:displayId(*)/:version', views.topLevel)362 app.get('/expose/:id', api.expose)363 function sparql (req, res) {364 // jena sends accept: */* and then complains when we send HTML365 // back. so only send html if the literal string text/html is present366 // in the accept header.367 let accept = req.header('accept')368 if (accept && accept.indexOf('text/html') !== -1) {369 views.sparql(req, res)370 } else {371 api.sparql(req, res)372 }373 }374 function sparqlAdmin (req, res) {375 // jena sends accept: */* and then complains when we send HTML376 // back. so only send html if the literal string text/html is present377 // in the accept header.378 let accept = req.header('accept')379 if (accept && accept.indexOf('text/html') !== -1) {380 views.admin.sparql(req, res)381 } else {382 api.admin.sparql(req, res)383 }384 }385 function requireUser (req, res, next) {386 if (!req.user) {387 if (!req.accepts('text/html')) {388 res.status(401).send('Login required')389 } else {390 res.redirect('/login?next=' + encodeURIComponent(req.url))391 }392 } else { next() }393 }394 function requireAdmin (req, res, next) {395 if (!req.user || !req.user.isAdmin) {396 if (!req.accepts('text/html')) {397 res.status(401).send('Administrator login required')398 } else {399 res.redirect('/login?next=' + encodeURIComponent(req.url))400 }401 } else { next() }402 }403 if (config.get('prewarmSearch')) {404 cache.update()405 }406 return app407}...

Full Screen

Full Screen

synbiohub.js

Source:synbiohub.js Github

copy

Full Screen

1$(document).on('click', '[data-uri]', function () {2 window.location = $(this).attr('data-uri')3})4$("body").tooltip({5 selector: '[data-toggle="tooltip"]',6 container: 'body'7})8$('.sbh-download-picture').click(function () {9 var element = $(document.getElementById("design").childNodes[0]);10 var clone = element.clone()11 element.find('*').each(function(i, elem) {12 $(elem).removeAttr('title')13 $(elem).removeData()14 })15 saveSvgAsPng(element[0], 'figure.png')16 element.replaceWith(clone)17})18$('.sbh-datatable').DataTable()19$(document).on('click', '.sbh-datatable .save', function () {20 const $row = $(this).closest('tr')21 const inputs = $row.find('input')22 const userInfo = {23 id: parseInt($(inputs[0]).val()),24 username: $(inputs[1]).val(),25 name: $(inputs[2]).val(),26 email: $(inputs[3]).val(),27 affiliation: $(inputs[4]).val(),28 isMember: $(inputs[5]).prop('checked'),29 isCurator: $(inputs[6]).prop('checked'),30 isAdmin: $(inputs[7]).prop('checked'),31 isMaintainer: $(inputs[8]).prop('checked')32 }33 $.post('/admin/updateUser', userInfo)34})35$(document).on('click', '.removeFromWoR', function() {36 let worSecret = $('#worSecret').val();37 let worUrl = $('#worUrl').val();38 let worId = $('#worId').val();39 let completeUrl = worUrl + '/instances/' + worId + '/';40 $.ajax({41 beforeSend: function(request) {42 request.setRequestHeader('updateSecret', worSecret)43 },44 method: 'DELETE',45 url: completeUrl,46 complete: (data, status, jqXHR) => {47 window.location.reload(true);48 }49 })50})51$(document).on('blur', '#user_edit #email', function() {52 const $username = $('#username');53 const $email = $(this).closest('#email');54 let email = $email.val();55 let username = email.split('@')[0].replace(/\W/g, '');56 $username.val(username);57})58$(document).on('blur', '#new #name', function() {59 const $id = $('input#id');60 const $name = $(this).closest('input#name');61 let name = $name.val();62 let id = "";63 for(let idx = 0; idx < name.length; idx++) {64 let c = name.charAt(idx);65 if(id.length > 0 && c.match(/[A-Za-z_0-9]/g)) {66 id = id + name.charAt(idx);67 } else if(id.length == 0 && c.match(/[A-Za-z_]/g)) {68 id = id + name.charAt(idx);69 }70 }71 $id.val(id);72})73$(document).on('click', '.sbh-datatable .delete', function () {74 const $row = $(this).closest('tr')75 const inputs = $row.find('input')76 const userInfo = {77 id: parseInt($(inputs[0]).val()),78 username: $(inputs[1]).val(),79 name: $(inputs[2]).val(),80 email: $(inputs[3]).val(),81 affiliation: $(inputs[4]).val(),82 isMember: $(inputs[5]).prop('checked'),83 isCurator: $(inputs[6]).prop('checked'),84 isAdmin: $(inputs[7]).prop('checked')85 }86 var dt = $(this).closest('.sbh-datatable').DataTable()87 $.post('/admin/deleteUser', userInfo, function () {88 dt.row($row).remove().draw()89 })90})91if (typeof meta !== 'undefined') {92 $('.sbh-collection-members-datatable').DataTable({93 processing: true,94 serverSide: true,95 searching: !meta.remote,96 order: [[0, "asc"]],97 columnDefs: [98 { "orderable": false, "targets": 2 }99 ],100 ordering: !meta.remote,101 102 ajax: {103 url: '/api/datatables',104 type: 'GET',105 data: function (d) {106 d.type = 'collectionMembers'107 d.collectionUri = meta.remote ? meta.uri.toString().replace("/1","/current") : meta.uri108 d.graphUri = meta.graphUri109 d.typeFilter = meta.typeFilter110 }111 }112 })113}114$(document).on('click', '.sbh-collection-members-datatable .delete', function () {115 if(!confirm('Are you sure you want to delete this object?')) {116 return117 }118 const $row = $(this).closest('tr')119 const removeUrl = $row.find('a').first().attr('href') + '/remove'120 var dt = $(this).closest('.sbh-collection-members-datatable').DataTable()121 $.get(removeUrl, function () {122 dt.row($row).remove().draw()123 })124})125$(document).on('click', '.sbh-collection-members-datatable .remove', function () {126 if(!confirm('Are you sure you want to remove this object from this collection?')) {127 return128 }129 const $row = $(this).closest('tr')130 const memberUrl = $row.find('a').first().attr('href') 131 const removeUrl = meta.url + '/removeMembership'132 var dt = $(this).closest('.sbh-collection-members-datatable').DataTable()133 var removeInfo = {134 member: memberUrl135 }136 137 $.post(removeUrl, removeInfo, function () {138 dt.row($row).remove().draw()139 })140})141function createPluginFunctions(pluginType) {142 $(document).on('click', '.save-' + pluginType + '-plugin', function () {143 const $row = $(this).closest('tr')144 145 var pluginInfo = {146 id: $row.find("#id").text(),147 name: $row.find('#name').val(),148 url: $row.find('#url').val(),149 category: pluginType150 }151 152 $.post('/admin/savePlugin', pluginInfo, function () {153 location.reload(true)154 })155 })156 157 $(document).on('click', '.delete-' + pluginType + '-plugin', function () {158 const $row = $(this).closest('tr')159 160 var pluginInfo = {161 id: $row.find("#id").text(),162 name: $row.find('#name').val(),163 url: $row.find('#url').val(),164 category: pluginType165 }166 167 $.post('/admin/deletePlugin', pluginInfo, function() {168 location.reload(true)169 })170 })171}172createPluginFunctions('submit')173createPluginFunctions('rendering')174createPluginFunctions('download')175$('.sbh-registries-datatable').DataTable({176 processing: false,177 serverSide: false,178 searching: false,179 ordering: false,180 paging: false181})182$(document).on('click', '.save-registry', function () {183 const $row = $(this).closest('tr')184 var registryInfo = {185 uri: $row.find('#uri').val(),186 url: $row.find('#url').val()187 }188 $.post('/admin/saveRegistry', registryInfo, function() { })189})190$(document).on('click', '.delete-registry', function () {191 const $row = $(this).closest('tr')192 var registryInfo = {193 uri: $row.find('#uri').val(),194 url: $row.find('#url').val()195 }196 var dt = $(this).closest('.sbh-registries-datatable').DataTable()197 $.post('/admin/deleteRegistry', registryInfo, function() {198 dt.row($row).remove().draw()199 })200})201$(".chosen-select").chosen()202require('./autocomplete')203require('./dataIntegration')204require('./visbol')205require('./sse')206require('./setup')207require('./plugin')208require('./field-editor')209require('./logs')210function createWikiEditor($el, saveButtonText, updateEndpoint) {211 var $buttons = {212 bold: $('<button class="btn"><span class="fa fa-bold"></span></button>').click(function () {213 $textarea.val($textarea.val() + '<b></b>').focus()214 return false215 }),216 italic: $('<button class="btn"><span class="fa fa-italic"></span></button>').click(function () {217 $textarea.val($textarea.val() + '<i></i>').focus()218 return false219 }),220 underline: $('<button class="btn"><span class="fa fa-underline"></span></button>').click(function () {221 $textarea.val($textarea.val() + '<u></u>').focus()222 return false223 }),224 image: $('<button class="btn sbh-wiki-add-image-button"><span class="fa fa-picture-o"></span></button>').click(insertImage),225 link: $('<button class="btn"><span class="fa fa-globe"></span></button>').click(function () {226 $textarea.val($textarea.val() + '<a href="http://example.com">link text</a>').focus()227 return false228 })229 }230 /* TODO hackkk231 */232 function getImageAttachments() {233 return $('.attachments-table tr').filter(function (i, tr) {234 return $(tr).children('td').first().text() === 'Image'235 }).map(function (i, tr) {236 return {237 name: $($(tr).children('td')[1]).text(),238 url: $(tr).find('a').attr('href') + '/download'239 }240 })241 }242 function insertImage() {243 var $dropdown = $('<div class="dropdown"></div>')244 var $dropdownMenu = $('<div class="dropdown-menu"></div>')245 $dropdown.append($dropdownMenu)246 getImageAttachments().each(function (i, attachment) {247 var $menuItem = $('<a class="dropdown-item"></a>')248 $menuItem.click(function () {249 $textarea.val($textarea.val() + '<img src="' + attachment.url + '"></img>').focus()250 $dropdown.detach()251 return false252 })253 $menuItem.text(attachment.name)254 $menuItem.attr('href', attachment.url)255 $dropdownMenu.append($menuItem)256 $dropdownMenu.append('<br/>')257 })258 $dropdownMenu.show()259 $('body').append($dropdown)260 $dropdown.offset($buttons.image.offset())261 setTimeout(function () {262 $('body').click(function () {263 $dropdown.detach()264 })265 }, 50)266 }267 var $topbar = $('<div></div>')268 .append($buttons.bold)269 .append($buttons.italic)270 .append($buttons.underline)271 .append($buttons.image)272 .append($buttons.link)273 var $textarea = $('<textarea class="form-control"></textarea>')274 var $saveButton = $('<button class="btn btn-primary">').text(saveButtonText)275 var $cancelButton = $('<button class="btn btn-default">').text('Cancel')276 $textarea.val($el.attr('data-src'))277 $textarea.attr('rows', $el.attr('data-src').split(/\r\n|\r|\n/).length)278 if (saveButtonText === 'Save Citations') {279 $textarea.attr('placeholder','Please enter comma-separated PubMedIds')280 }281 var $div = $('<div></div>')282 if (saveButtonText !== 'Save Citations') {283 $div.append($topbar)284 }285 $div.append($textarea)286 .append($saveButton)287 .append($cancelButton)288 var $orig = $el289 $el.replaceWith($div)290 $cancelButton.click(function () {291 $div.replaceWith($orig)292 })293 $saveButton.click(function () {294 var value = $textarea.val()295 $.post(updateEndpoint, {296 uri: meta.uri,297 value: value,298 }, function (res) {299 $div.replaceWith($(res))300 })301 })302 $textarea.focus()303}304$(document).on('click', '#sbh-add-description', function () {305 createWikiEditor($('#sbh-description'), 'Save Description', '/updateMutableDescription')306 return false307})308$(document).on('click', '#sbh-edit-description', function () {309 createWikiEditor($('#sbh-description'), 'Save Description', '/updateMutableDescription')310 return false311})312$(document).on('click', '#sbh-add-notes', function () {313 createWikiEditor($('#sbh-notes'), 'Save Notes', '/updateMutableNotes')314 return false315})316$(document).on('click', '#sbh-edit-notes', function () {317 createWikiEditor($('#sbh-notes'), 'Save Notes', '/updateMutableNotes')318 return false319})320$(document).on('click', '#sbh-add-source', function () {321 createWikiEditor($('#sbh-source'), 'Save Source', '/updateMutableSource')322 return false323})324$(document).on('click', '#sbh-edit-source', function () {325 createWikiEditor($('#sbh-source'), 'Save Source', '/updateMutableSource')326 return false327})328$(document).on('click', '#sbh-add-citations', function () {329 createWikiEditor($('#sbh-citations'), 'Save Citations', '/updateCitations')330 return false331})332$(document).on('click', '#sbh-edit-citations', function () {333 createWikiEditor($('#sbh-citations'), 'Save Citations', '/updateCitations')334 return false335})336// https://www.abeautifulsite.net/whipping-file-inputs-into-shape-with-bootstrap-3337//338$(function () {339 // We can attach the `fileselect` event to all file inputs on the page340 $(document).on('change', ':file', function () {341 var input = $(this),342 numFiles = input.get(0).files ? input.get(0).files.length : 1,343 label = input.val().replace(/\\/g, '/').replace(/.*\//, '');344 input.trigger('fileselect', [numFiles, label]);345 });346 // We can watch for our custom `fileselect` event like this347 $(document).ready(function () {348 $(':file').on('fileselect', function (event, numFiles, label) {349 let id = $(this).attr('form')350 let input = $(':text[form=' + id + ']')351 let log = numFiles > 1 ? numFiles + ' files selected' : label352 input.val(log)353 });354 });355});356$('#sbh-attachment-upload').submit(function (e) {357 e.preventDefault()358 var formData = new FormData($(this)[0])359 $.ajax({360 url: $(this).attr('action'),361 method: 'post',362 data: formData,363 cache: false,364 contentType: false,365 processData: false,366 success: function (data) {367 $('.attachments-table').replaceWith($('<div></div>').html(data).find('.attachments-table'))368 var form = $(':file').val('').closest('form')369 form.find('button[type=submit]').prop('disabled', true).removeClass('btn-success')370 $(':file').parents('.input-group').find(':text').val('')371 }372 })373 return false374})375require('./url-attachments')376$('.sbh-sparql-editor').each((i, textarea) => {377 var cm = CodeMirror.fromTextArea(textarea, {378 lineNumbers: true379 })380})381const extend = require('xtend')382function getFields(type) {383 var fields = {384 id: {385 type: 'text',386 default: '',387 name: 'ID'388 },389 type: {390 type: 'value',391 default: '',392 name: 'Type'393 },394 url: {395 type: 'text',396 default: '',397 name: 'URL'398 },399 sequenceSuffix: {400 type: 'text',401 default: '_sequence',402 name: 'Sequence Suffix'403 },404 defaultFolderId: {405 type: 'text',406 default: '',407 name: 'Default Folder ID'408 },409 isPublic: {410 type: 'checkbox',411 default: false,412 name: 'Public'413 },414 rejectUnauthorized: {415 type: 'checkbox',416 default: false,417 name: 'Reject Unauthorized'418 },419 folderPrefix: {420 type: 'text',421 default: 'folder_',422 name: 'Folder Prefix'423 },424 rootCollectionDisplayId: {425 type: 'text',426 default: '',427 name: 'Root Collection Display ID'428 },429 rootCollectionName: {430 type: 'text',431 default: '',432 name: 'Root Collection Name'433 },434 rootCollectionDescription: {435 type: 'textarea',436 default: '',437 name: 'Root Collection Description'438 }439 }440 var specificFields = {441 ice: {442 iceApiToken: {443 type: 'text',444 default: '',445 name: 'ICE API Token'446 },447 iceApiTokenClient: {448 type: 'text',449 default: '',450 name: 'ICE API Token Client'451 },452 iceApiTokenOwner: {453 type: 'text',454 default: '',455 name: 'ICE API Token Owner'456 },457 iceCollection: {458 type: 'text',459 default: 'FEATURED',460 name: 'ICE Collection'461 },462 groupId: {463 type: 'text',464 default: '',465 name: 'Group ID'466 },467 pi: {468 type: 'text',469 default: '',470 name: 'PI'471 },472 piEmail: {473 type: 'text',474 default: '',475 name: 'PI Email'476 },477 partNumberPrefix: {478 type: 'text',479 default: '',480 name: 'Part Number Prefix'481 }482 },483 benchling: {484 benchlingApiToken: {485 type: 'text',486 default: '',487 name: 'Benchling API Token'488 },489 defaultFolderId: {490 type: 'text',491 default: '',492 name: 'Default Folder ID'493 },494 }495 }496 return extend(fields, specificFields[type])497}498function clearForm() {499 var $form = $('#remoteForm').empty();500}501function populateForm(type, data) {502 var $form = $('#remoteForm');503 const fields = getFields(type);504 Object.keys(fields).forEach(key => {505 var fieldInfo = fields[key];506 var $label = $("<label />").attr("for", key).text(fieldInfo.name);507 var $input = {508 "text": $("<input />").attr("type", "text").val(fieldInfo.default),509 "checkbox": $("<input />").attr("type", "checkbox").prop("checked", fieldInfo.default),510 "textarea": $("<textarea />").val(fieldInfo.default),511 "value": $("<input />").attr("type", "text").attr('readonly', 'readonly').val(fieldInfo.default),512 }[fieldInfo.type].attr("name", key).addClass("form-control")513 if(data[key]) {514 if (fieldInfo.type === "checkbox") {515 $input.prop("checked", data[key])516 } else {517 $input.val(data[key]);518 }519 if(key == "id") {520 $input.attr('readonly', 'readonly')521 }522 }523 var $group = $("<div />").addClass('form-group').append($label, $input)524 $('#remoteForm').append($group)525 })526}527$('#remoteTypeSelect').on('change', function () {528 var type = $(this).val()529 if (type !== "") {530 clearForm();531 $('#addRemote').attr('disabled', false);532 populateForm(type, {"type": type})533 } else {534 $('#addRemote').attr('disabled', true);535 clearForm();536 }537})538$(document).on('click', '#remoteEdit', function () {539 clearForm();540 var id = $(this).closest('table').find('#remote-id').text();541 var remote = remotes.find((remote) => {542 return remote.id == id;543 })544 var data = {545 "ice": {546 id: remote["id"],547 type: "ice",548 url: remote["url"],549 rejectUnauthorized: remote["rejectUnauthorized"],550 isPublic: remote["public"] || false,551 folderPrefix: remote["folderPrefix"],552 sequenceSuffix: remote["sequenceSuffix"],553 defaultFolderId: remote["defaultFolderId"],554 rootCollectionDisplayId: remote.rootCollection["displayId"],555 rootCollectionName: remote.rootCollection["name"],556 rootCollectionDescription: remote.rootCollection["description"],557 iceApiToken: remote["X-ICE-API-Token"],558 iceApiTokenClient: remote["X-ICE-API-Token-Client"],559 iceApiTokenOwner: remote["X-ICE-API-Token-Owner"],560 iceCollection: remote["iceCollection"],561 groupId: remote["groupId"],562 pi: remote["PI"],563 partNumberPrefix: remote["partNumberPrefix"],564 piEmail: remote["PIemail"],565 },566 "benchling": {567 id: remote["id"],568 type: "benchling",569 url: remote["url"],570 rejectUnauthorized: remote["rejectUnauthorized"],571 isPublic: remote["public"] || false,572 folderPrefix: remote["folderPrefix"],573 sequenceSuffix: remote["sequenceSuffix"],574 defaultFolderId: remote["defaultFolderId"],575 rootCollectionDisplayId: remote.rootCollection["displayId"],576 rootCollectionName: remote.rootCollection["name"],577 rootCollectionDescription: remote.rootCollection["description"],578 benchlingApiToken: remote["X-BENCHLING-API-Token"],579 defaultFolderId: remote["defaultFolderId"],580 }581 }[remote.type]582 populateForm(remote.type, data)583})584$(document).on('click', '.remove-attachment', function() {585 let $row = $(this).closest('tr');586 let attachmentUri = $row.find('a').first().attr('href');587 $.get(attachmentUri + "/remove")588 .done(() => $row.remove())589 .error(() => alert("Could not remove attachment!"));590})591$('form[action="/setup"] select[name="authProvider"]').change(function () {592 const providerName = this.value;593 const parentEl = $(this).closest('.form-group');594 parentEl.find('div[class^="auth-"]').hide();595 parentEl.find('div.auth-' + providerName).show();...

Full Screen

Full Screen

ReactFiberHooks.js

Source:ReactFiberHooks.js Github

copy

Full Screen

1import ReactCurrentDispatcher from "../react/ReactCurrentDispatcher";2import { requestEventTime, requestUpdateLane } from "./ReactFiberWorkLoop";3import {4 Update as UpdateEffect,5 Passive as PassiveEffect,6} from "./ReactFiberFlags";7import {8 HasEffect as HookHasEffect,9 Layout as HookLayout,10 Passive as HookPassive,11} from "./ReactHookEffectTags";12// The work-in-progress fiber. I've named it differently to distinguish it from13// the work-in-progress hook.14let currentlyRenderingFiber = null;15// Hooks are stored as a linked list on the fiber's memoizedState field. The16// current hook list is the list that belongs to the current fiber. The17// work-in-progress hook list is a new list that will be added to the18// work-in-progress fiber.19// Hooks 用链表结构, 存贮在fiber's memoizedState字段20// Hook | null21let currentHook = null;22// Hook | null23let workInProgressHook = null;24// Whether an update was scheduled at any point during the render phase. This25// does not get reset if we do another render pass; only when we're completely26// finished evaluating this component. This is an optimization so we know27// whether we need to clear render phase updates after a throw.28let didScheduleRenderPhaseUpdate = false;29// Where an update was scheduled only during the current render pass. This30// gets reset after each attempt.31// TODO: Maybe there's some way to consolidate this with32// `didScheduleRenderPhaseUpdate`. Or with `numberOfReRenders`.33let didScheduleRenderPhaseUpdateDuringThisPass = false;34export function renderWithHooks(35 // null36 current,37 workInProgress,38 // 这里是函数组件, 其实就是wip.type39 Component,40 // wip.props41 props,42 // context43 secondArg,44 nextRenderLanes45) {46 renderLanes = nextRenderLanes;47 currentlyRenderingFiber = workInProgress;48 // 为何这边就已经清空 memoizedState 和 updateQueue 了?49 workInProgress.memoizedState = null;50 workInProgress.updateQueue = null;51 workInProgress.lanes = NoLanes;52 // The following should have already been reset53 // currentHook = null;54 // workInProgressHook = null;55 // didScheduleRenderPhaseUpdate = false;56 // TODO Warn if no hooks are used at all during mount, then some are used during update.57 // Currently we will identify the update render as a mount because memoizedState === null.58 // This is tricky because it's valid for certain types of components (e.g. React.lazy)59 // Using memoizedState to differentiate between mount/update only works if at least one stateful hook is used.60 // Non-stateful hooks (e.g. context) don't get added to memoizedState,61 // so memoizedState would be null during updates and mounts.62 // Dispatcher 跟useState有关63 ReactCurrentDispatcher.current =64 current === null || current.memoizedState === null65 ? HooksDispatcherOnMount66 : HooksDispatcherOnUpdate;67 // 直接执行组件函数, 得到一个 jsx object68 let children = Component(props, secondArg);69 // Check if there was a render phase update70 if (didScheduleRenderPhaseUpdateDuringThisPass) {71 // Keep rendering in a loop for as long as render phase updates continue to72 // be scheduled. Use a counter to prevent infinite loops.73 let numberOfReRenders = 0;74 do {75 didScheduleRenderPhaseUpdateDuringThisPass = false;76 invariant(77 numberOfReRenders < RE_RENDER_LIMIT,78 "Too many re-renders. React limits the number of renders to prevent " +79 "an infinite loop."80 );81 numberOfReRenders += 1;82 // Start over from the beginning of the list83 currentHook = null;84 workInProgressHook = null;85 workInProgress.updateQueue = null;86 ReactCurrentDispatcher.current = HooksDispatcherOnRerender;87 children = Component(props, secondArg);88 } while (didScheduleRenderPhaseUpdateDuringThisPass);89 }90 // We can assume the previous dispatcher is always this one, since we set it91 // at the beginning of the render phase and there's no re-entrancy.92 ReactCurrentDispatcher.current = ContextOnlyDispatcher;93 // This check uses currentHook so that it works the same in DEV and prod bundles.94 // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.95 const didRenderTooFewHooks =96 currentHook !== null && currentHook.next !== null;97 renderLanes = NoLanes;98 currentlyRenderingFiber = null;99 currentHook = null;100 workInProgressHook = null;101 didScheduleRenderPhaseUpdate = false;102 invariant(103 !didRenderTooFewHooks,104 "Rendered fewer hooks than expected. This may be caused by an accidental " +105 "early return statement."106 );107 return children;108}109function mountWorkInProgressHook() {110 const hook = {111 memoizedState: null,112 baseState: null,113 baseQueue: null,114 queue: null,115 next: null,116 };117 if (workInProgressHook === null) {118 // This is the first hook in the list119 currentlyRenderingFiber.memoizedState = workInProgressHook = hook;120 } else {121 // 一个函数组件里面, 两个以上的hook就走这里, 链起来了~122 // Append to the end of the list123 workInProgressHook = workInProgressHook.next = hook;124 }125 return workInProgressHook;126}127function createFunctionComponentUpdateQueue() {128 return {129 lastEffect: null,130 };131}132/**133 * 把tag为 HookHasEffect|HookPassive的effect压入fiber.updateQueue134 */135function pushEffect(tag, create, destroy, deps) {136 const effect = {137 tag,138 create,139 destroy,140 deps,141 // Circular142 next: null,143 };144 // 在我学习的例子里, 这个fiber是App函数组件, 对应的fiber节点是没有updateQueue的(创建的时候就没有初始化)145 let componentUpdateQueue = currentlyRenderingFiber.updateQueue;146 if (componentUpdateQueue === null) {147 componentUpdateQueue = createFunctionComponentUpdateQueue();148 currentlyRenderingFiber.updateQueue = componentUpdateQueue;149 componentUpdateQueue.lastEffect = effect.next = effect;150 } else {151 // 这里跟updateQueue.shared.pending那个双循环有些不一样,152 const lastEffect = componentUpdateQueue.lastEffect;153 if (lastEffect === null) {154 componentUpdateQueue.lastEffect = effect.next = effect;155 } else {156 const firstEffect = lastEffect.next;157 lastEffect.next = effect;158 effect.next = firstEffect;159 componentUpdateQueue.lastEffect = effect;160 }161 }162 return effect;163}164function mountEffectImpl(fiberFlags, hookFlags, create, deps) {165 const hook = mountWorkInProgressHook();166 const nextDeps = deps === undefined ? null : deps;167 // 哦吼, 就在这, 这个fiber上有了 PassiveEffect168 // 在我学的例子里, 对于component App, 其flags在创建的时候169 // 由 placeSingleChild 函数打上 Placement = 2170 // 这里再跟 UpdateEffect | PassiveEffect 做合并171 currentlyRenderingFiber.flags |= fiberFlags;172 // 只是压入updateQueue, **并不执行**173 // 注意, 这里destroy暂时为undefined, 因为destroy函数是create函数的返回值174 hook.memoizedState = pushEffect(175 HookHasEffect | hookFlags,176 create,177 undefined,178 nextDeps179 );180}181function mountEffect(create, deps) {182 return mountEffectImpl(183 UpdateEffect | PassiveEffect,184 HookPassive,185 create,186 deps187 );188}189function mountState(initialState) {190 // wip.memoizedState 塞一个空的hook对象,作为hook单链表的起点(?)191 const hook = mountWorkInProgressHook();192 if (typeof initialState === "function") {193 // useState的初始状态是函数, 这里执行函数, 返回值赋值给initialState194 initialState = initialState();195 }196 hook.memoizedState = hook.baseState = initialState;197 const queue = (hook.queue = {198 pending: null,199 dispatch: null,200 lastRenderedReducer: basicStateReducer,201 lastRenderedState: initialState,202 });203 // const [a, setA] = useState('a')204 // setA 就是这里的 dispatchAction205 const dispatch = (queue.dispatch = dispatchAction.bind(206 null,207 currentlyRenderingFiber,208 queue209 ));210 return [hook.memoizedState, dispatch];211}212// 这函数回头再看213function dispatchAction(fiber, queue, action) {214 const eventTime = requestEventTime();215 const lane = requestUpdateLane(fiber);216 const update = {217 lane,218 action,219 eagerReducer: null,220 eagerState: null,221 next: null,222 };223 // Append the update to the end of the list.224 const pending = queue.pending;225 if (pending === null) {226 // This is the first update. Create a circular list.227 update.next = update;228 } else {229 update.next = pending.next;230 pending.next = update;231 }232 queue.pending = update;233 const alternate = fiber.alternate;234 if (235 fiber === currentlyRenderingFiber ||236 (alternate !== null && alternate === currentlyRenderingFiber)237 ) {238 // This is a render phase update. Stash it in a lazily-created map of239 // queue -> linked list of updates. After this render pass, we'll restart240 // and apply the stashed updates on top of the work-in-progress hook.241 didScheduleRenderPhaseUpdateDuringThisPass =242 didScheduleRenderPhaseUpdate = true;243 } else {244 if (245 fiber.lanes === NoLanes &&246 (alternate === null || alternate.lanes === NoLanes)247 ) {248 // The queue is currently empty, which means we can eagerly compute the249 // next state before entering the render phase. If the new state is the250 // same as the current state, we may be able to bail out entirely.251 const lastRenderedReducer = queue.lastRenderedReducer;252 if (lastRenderedReducer !== null) {253 let prevDispatcher;254 try {255 const currentState = queue.lastRenderedState;256 const eagerState = lastRenderedReducer(currentState, action);257 // Stash the eagerly computed state, and the reducer used to compute258 // it, on the update object. If the reducer hasn't changed by the259 // time we enter the render phase, then the eager state can be used260 // without calling the reducer again.261 update.eagerReducer = lastRenderedReducer;262 update.eagerState = eagerState;263 if (is(eagerState, currentState)) {264 // Fast path. We can bail out without scheduling React to re-render.265 // It's still possible that we'll need to rebase this update later,266 // if the component re-renders for a different reason and by that267 // time the reducer has changed.268 return;269 }270 } catch (error) {271 // Suppress the error. It will throw again in the render phase.272 }273 }274 }275 // 开始render阶段咯276 scheduleUpdateOnFiber(fiber, lane, eventTime);277 }278}279export const ContextOnlyDispatcher = {280 readContext,281 useCallback: throwInvalidHookError,282 useContext: throwInvalidHookError,283 useEffect: throwInvalidHookError,284 useImperativeHandle: throwInvalidHookError,285 useLayoutEffect: throwInvalidHookError,286 useMemo: throwInvalidHookError,287 useReducer: throwInvalidHookError,288 useRef: throwInvalidHookError,289 useState: throwInvalidHookError,290 useDebugValue: throwInvalidHookError,291 useDeferredValue: throwInvalidHookError,292 useTransition: throwInvalidHookError,293 useMutableSource: throwInvalidHookError,294 useOpaqueIdentifier: throwInvalidHookError,295 unstable_isNewReconciler: enableNewReconciler,296};297const HooksDispatcherOnMount = {298 readContext,299 useCallback: mountCallback,300 useContext: readContext,301 useEffect: mountEffect,302 useImperativeHandle: mountImperativeHandle,303 useLayoutEffect: mountLayoutEffect,304 useMemo: mountMemo,305 useReducer: mountReducer,306 useRef: mountRef,307 useState: mountState,308 useDebugValue: mountDebugValue,309 useDeferredValue: mountDeferredValue,310 useTransition: mountTransition,311 useMutableSource: mountMutableSource,312 useOpaqueIdentifier: mountOpaqueIdentifier,313 unstable_isNewReconciler: enableNewReconciler,314};315const HooksDispatcherOnUpdate = {316 readContext,317 useCallback: updateCallback,318 useContext: readContext,319 useEffect: updateEffect,320 useImperativeHandle: updateImperativeHandle,321 useLayoutEffect: updateLayoutEffect,322 useMemo: updateMemo,323 useReducer: updateReducer,324 useRef: updateRef,325 useState: updateState,326 useDebugValue: updateDebugValue,327 useDeferredValue: updateDeferredValue,328 useTransition: updateTransition,329 useMutableSource: updateMutableSource,330 useOpaqueIdentifier: updateOpaqueIdentifier,331 unstable_isNewReconciler: enableNewReconciler,332};333const HooksDispatcherOnRerender = {334 readContext,335 useCallback: updateCallback,336 useContext: readContext,337 useEffect: updateEffect,338 useImperativeHandle: updateImperativeHandle,339 useLayoutEffect: updateLayoutEffect,340 useMemo: updateMemo,341 useReducer: rerenderReducer,342 useRef: updateRef,343 useState: rerenderState,344 useDebugValue: updateDebugValue,345 useDeferredValue: rerenderDeferredValue,346 useTransition: rerenderTransition,347 useMutableSource: updateMutableSource,348 useOpaqueIdentifier: rerenderOpaqueIdentifier,349 unstable_isNewReconciler: enableNewReconciler,...

Full Screen

Full Screen

updateMutableSource.js

Source:updateMutableSource.js Github

copy

Full Screen

1const pug = require('pug')2const sparql = require('../sparql/sparql')3const loadTemplate = require('../loadTemplate')4const config = require('../config')5const getGraphUriFromTopLevelUri = require('../getGraphUriFromTopLevelUri')6const wiky = require('../wiky/wiky')7const getOwnedBy = require('../query/ownedBy')8module.exports = function (req, res) {9 const uri = req.body.uri10 const graphUri = getGraphUriFromTopLevelUri(uri, req.user)11 const source = req.body.value12 var sourceSparql = ''13 if (source.trim() !== '') {14 sourceSparql = '<' + uri + '> sbh:mutableProvenance ' + JSON.stringify(source) + ' .'15 }16 var d = new Date()17 var modified = d.toISOString()18 modified = modified.substring(0, modified.indexOf('.'))19 const updateQuery = loadTemplate('./sparql/UpdateMutableSource.sparql', {20 topLevel: uri,21 source: sourceSparql,22 modified: JSON.stringify(modified)23 })24 getOwnedBy(uri, graphUri).then((ownedBy) => {25 if (ownedBy.indexOf(config.get('databasePrefix') + 'user/' + req.user.username) === -1) {26 res.status(401).send('not authorized to edit this submission')27 return28 }29 return sparql.updateQuery(updateQuery, graphUri).then((result) => {30 if (!req.accepts('text/html')) {31 return res.status(200).send('Success')32 } else {33 const locals = {34 config: config.get(),35 src: source,36 source: source !== '' ? wiky.process(source, {}) : '',37 canEdit: true38 }39 res.send(pug.renderFile('templates/partials/mutable-source.jade', locals))40 }41 })42 })...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const playwright = require('playwright');2(async () => {3 const browser = await playwright.chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.screenshot({ path: `example.png` });7 await browser.close();8})();9const playwright = require('playwright');10describe('Playwright Internal API', () => {11 it('should update the source of the document', async () => {12 const browser = await playwright.chromium.launch();13 const context = await browser.newContext();14 const page = await context.newPage();15 await page.screenshot({ path: `example.png` });16 await browser.close();17 });18});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.evaluate(() => {7 const source = new EventSource('/sse');8 source.onmessage = (event) => {9 console.log(event.data);10 };11 });12 await page.updateMutableSource('/sse', 'message', 'Hello World');13 await page.close();14 await context.close();15 await browser.close();16})();17 const source = new EventSource('/sse');18 source.onmessage = (event) => {19 console.log(event.data);20 };21const http = require('http');22const fs = require('fs');23const path = require('path');24let counter = 0;25const server = http.createServer((request, response) => {26 if (request.url === '/sse') {27 response.writeHead(200, {28 });29 setInterval(() => {30 response.write(`data: ${counter++}31`);32 }, 1000);33 } else {34 response.writeHead(200, {35 });36 response.write(fs

Full Screen

Using AI Code Generation

copy

Full Screen

1const { updateMutableSource } = require('@playwright/test/lib/server/mutableSources');2const { loadTestFile } = require('@playwright/test/lib/test/workerRunner');3const { registerFixture } = require('@playwright/test/lib/test/fixtures');4const { registerWorkerFixture } = require('@playwright/test/lib/test/fixtures');5const { registerFixtureWorker } = require('@playwright/test/lib/test/fixtures');6const { registerWorkerFixture as registerWorkerFixtureMethod } = require('@playwright/test/lib/test/fixtures');7const { registerFixture as registerFixtureMethod } = require('@playwright/test/lib/test/fixtures');8const { registerFixture as registerFixtureMethod } = require('@playwright/test/lib/test/fixtures');9const { registerFixture as registerFixtureMethod } = require('@playwright/test/lib/test/fixtures');10const { registerFixture as registerFixtureMethod } = require('@playwright/test/lib/test/fixtures');11const { registerFixture as registerFixtureMethod } = require('@playwright/test/lib/test/fixtures');12const { registerFixture as registerFixtureMethod } = require('@playwright/test/lib/test/fixtures');13const { registerFixture as registerFixtureMethod } = require('@playwright/test/lib/test/fixtures');14const { registerFixture as registerFixtureMethod } = require('@playwright/test/lib/test/fixtures');15const { registerFixture as registerFixtureMethod } = require('@playwright/test/lib/test/fixtures');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { updateMutableSource } = require('playwright/lib/server/chromium/crPage');2await updateMutableSource(this.page, 'newSourceCode');3const { updateMutableSource } = require('playwright/lib/server/chromium/crPage');4await updateMutableSource(this.page.frames()[0], 'newSourceCode');5const { updateMutableSource } = require('playwright/lib/server/chromium/crPage');6await updateMutableSource(this.page, 'newSourceCode');7const { updateMutableSource } = require('playwright/lib/server/chromium/crPage');8await updateMutableSource(this.page.frames()[0], 'newSourceCode');

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal 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