code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function flatPromise() { let resolveFn let rejectFn const p = new Promise((resolve, reject) => { resolveFn = resolve rejectFn = reject }) return [p, resolveFn, rejectFn] }
Create a promise and obtain the resolve/reject functions outside of the Promise callback.
flatPromise
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
function waitableFunction(name = 'func') { const [promise, resolve] = flatPromise() const fn = jasmine.createSpy(name, resolve).and.callThrough() fn.toBeCalled = () => promise return fn }
Create a spy-able function which resolves a Promise once it is called.
waitableFunction
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
function wait(delay) { return new Promise((resolve) => { setTimeout(resolve, delay, 'timed out') }) }
Create a Promise that resolves after the specified duration.
wait
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
constructor() { this._pendingRequests = [] this._pendingWaits = [] }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
constructor
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
createRequest(method, url) { return new TestRequest(method, url, (req) => { if (this._pendingWaits.length >= 1) { const handler = this._pendingWaits.shift() handler(req) return } this._pendingRequests.push(req) }) }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
createRequest
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
nextRequest() { if (this._pendingRequests.length >= 1) { return Promise.resolve(this._pendingRequests.shift()) } return new Promise((resolve) => { this._pendingWaits.push(resolve) }) }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
nextRequest
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
constructor(method, url, onRequestSend) { this.method = method this.url = url this.requestHeaders = {} this.body = null this.bodySize = null this._onRequestSend = onRequestSend this._onProgress = () => {} ;[this._requestPromise, this._resolveRequest, this._rejectRequest] = flatPromise() }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
constructor
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
getMethod() { return this.method }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
getMethod
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
getURL() { return this.url }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
getURL
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
setHeader(header, value) { this.requestHeaders[header] = value }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
setHeader
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
getHeader(header) { return this.requestHeaders[header] || null }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
getHeader
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
setProgressHandler(progressHandler) { this._onProgress = progressHandler }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
setProgressHandler
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
async send(body = null) { this.body = body if (body) { this.bodySize = await getBodySize(body) this._onProgress(0) this._onProgress(this.bodySize) } this._onRequestSend(this) return this._requestPromise }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
send
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
abort() { this._rejectRequest(new Error('request aborted')) }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
abort
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
getUnderlyingObject() { throw new Error('not implemented') }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
getUnderlyingObject
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
respondWith(resData) { resData.responseHeaders = resData.responseHeaders || {} const res = new TestResponse(resData) this._resolveRequest(res) }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
respondWith
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
async function getBodySize(body) { if (body == null) { return null } if ( body instanceof ArrayBuffer || (typeof SharedArrayBuffer !== 'undefined' && body instanceof SharedArrayBuffer) || ArrayBuffer.isView(body) ) { return body.byteLength } if (body instanceof Blob) { return body.size } if (body.length != null) { return body.length } return new Promise((resolve) => { body.on('readable', () => { while (true) { const chunk = body.read() if (chunk == null) break resolve(chunk.length) } }) }) }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
getBodySize
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
constructor(res) { this._response = res }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
constructor
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
getStatus() { return this._response.status }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
getStatus
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
getHeader(header) { return this._response.responseHeaders[header] }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
getHeader
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
getBody() { return this._response.responseText }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
getBody
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
getUnderlyingObject() { throw new Error('not implemented') }
TestHttpStack implements the HTTP stack interface for tus-js-client and can be used to assert outgoing requests and respond with mock data.
getUnderlyingObject
javascript
tus/tus-js-client
test/spec/helpers/utils.js
https://github.com/tus/tus-js-client/blob/master/test/spec/helpers/utils.js
MIT
function Component(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
Component
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
defineDeprecationWarning = function(methodName, info) { Object.defineProperty(Component.prototype, methodName, { get: function() { warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]); return void 0; } }); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
defineDeprecationWarning
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function PureComponent(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
PureComponent
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function createRef() { var refObject = { current: null }; { Object.seal(refObject); } return refObject; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
createRef
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function isArray(a) { return isArrayImpl(a); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
isArray
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function typeName(value) { { var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object"; return type; } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
typeName
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function willCoercionThrow(value) { { try { testStringCoercion(value); return false; } catch (e) { return true; } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
willCoercionThrow
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function testStringCoercion(value) { return "" + value; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
testStringCoercion
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function checkKeyStringCoercion(value) { { if (willCoercionThrow(value)) { error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value)); return testStringCoercion(value); } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
checkKeyStringCoercion
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function getWrappedName(outerType, innerType, wrapperName) { var displayName = outerType.displayName; if (displayName) { return displayName; } var functionName = innerType.displayName || innerType.name || ""; return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
getWrappedName
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function getContextName(type) { return type.displayName || "Context"; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
getContextName
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function getComponentNameFromType(type) { if (type == null) { return null; } { if (typeof type.tag === "number") { error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."); } } if (typeof type === "function") { return type.displayName || type.name || null; } if (typeof type === "string") { return type; } switch (type) { case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PORTAL_TYPE: return "Portal"; case REACT_PROFILER_TYPE: return "Profiler"; case REACT_STRICT_MODE_TYPE: return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; } if (typeof type === "object") { switch (type.$$typeof) { case REACT_CONTEXT_TYPE: var context = type; return getContextName(context) + ".Consumer"; case REACT_PROVIDER_TYPE: var provider = type; return getContextName(provider._context) + ".Provider"; case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, "ForwardRef"); case REACT_MEMO_TYPE: var outerName = type.displayName || null; if (outerName !== null) { return outerName; } return getComponentNameFromType(type.type) || "Memo"; case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return getComponentNameFromType(init(payload)); } catch (x) { return null; } } } } return null; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
getComponentNameFromType
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function hasValidRef(config) { { if (hasOwnProperty.call(config, "ref")) { var getter = Object.getOwnPropertyDescriptor(config, "ref").get; if (getter && getter.isReactWarning) { return false; } } } return config.ref !== void 0; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
hasValidRef
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function hasValidKey(config) { { if (hasOwnProperty.call(config, "key")) { var getter = Object.getOwnPropertyDescriptor(config, "key").get; if (getter && getter.isReactWarning) { return false; } } } return config.key !== void 0; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
hasValidKey
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function defineKeyPropWarningGetter(props, displayName) { var warnAboutAccessingKey = function() { { if (!specialPropKeyWarningShown) { specialPropKeyWarningShown = true; error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName); } } }; warnAboutAccessingKey.isReactWarning = true; Object.defineProperty(props, "key", { get: warnAboutAccessingKey, configurable: true }); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
defineKeyPropWarningGetter
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
warnAboutAccessingKey = function() { { if (!specialPropKeyWarningShown) { specialPropKeyWarningShown = true; error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName); } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
warnAboutAccessingKey
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function defineRefPropWarningGetter(props, displayName) { var warnAboutAccessingRef = function() { { if (!specialPropRefWarningShown) { specialPropRefWarningShown = true; error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName); } } }; warnAboutAccessingRef.isReactWarning = true; Object.defineProperty(props, "ref", { get: warnAboutAccessingRef, configurable: true }); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
defineRefPropWarningGetter
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
warnAboutAccessingRef = function() { { if (!specialPropRefWarningShown) { specialPropRefWarningShown = true; error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName); } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
warnAboutAccessingRef
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function warnIfStringRefCannotBeAutoConverted(config) { { if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); if (!didWarnAboutStringRefs[componentName]) { error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref); didWarnAboutStringRefs[componentName] = true; } } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
warnIfStringRefCannotBeAutoConverted
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
ReactElement = function(type, key, ref, self, source, owner, props) { var element = { // This tag allows us to uniquely identify this as a React Element $$typeof: REACT_ELEMENT_TYPE, // Built-in properties that belong on the element type, key, ref, props, // Record the component responsible for creating this element. _owner: owner }; { element._store = {}; Object.defineProperty(element._store, "validated", { configurable: false, enumerable: false, writable: true, value: false }); Object.defineProperty(element, "_self", { configurable: false, enumerable: false, writable: false, value: self }); Object.defineProperty(element, "_source", { configurable: false, enumerable: false, writable: false, value: source }); if (Object.freeze) { Object.freeze(element.props); Object.freeze(element); } } return element; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
ReactElement
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function createElement(type, config, children) { var propName; var props = {}; var key = null; var ref = null; var self = null; var source = null; if (config != null) { if (hasValidRef(config)) { ref = config.ref; { warnIfStringRefCannotBeAutoConverted(config); } } if (hasValidKey(config)) { { checkKeyStringCoercion(config.key); } key = "" + config.key; } self = config.__self === void 0 ? null : config.__self; source = config.__source === void 0 ? null : config.__source; for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { props[propName] = config[propName]; } } } var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } { if (Object.freeze) { Object.freeze(childArray); } } props.children = childArray; } if (type && type.defaultProps) { var defaultProps = type.defaultProps; for (propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } { if (key || ref) { var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type; if (key) { defineKeyPropWarningGetter(props, displayName); } if (ref) { defineRefPropWarningGetter(props, displayName); } } } return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
createElement
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function cloneAndReplaceKey(oldElement, newKey) { var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); return newElement; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
cloneAndReplaceKey
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function cloneElement(element, config, children) { if (element === null || element === void 0) { throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + "."); } var propName; var props = assign({}, element.props); var key = element.key; var ref = element.ref; var self = element._self; var source = element._source; var owner = element._owner; if (config != null) { if (hasValidRef(config)) { ref = config.ref; owner = ReactCurrentOwner.current; } if (hasValidKey(config)) { { checkKeyStringCoercion(config.key); } key = "" + config.key; } var defaultProps; if (element.type && element.type.defaultProps) { defaultProps = element.type.defaultProps; } for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { if (config[propName] === void 0 && defaultProps !== void 0) { props[propName] = defaultProps[propName]; } else { props[propName] = config[propName]; } } } } var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } props.children = childArray; } return ReactElement(element.type, key, ref, self, source, owner, props); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
cloneElement
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function isValidElement(object) { return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
isValidElement
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function escape(key) { var escapeRegex = /[=:]/g; var escaperLookup = { "=": "=0", ":": "=2" }; var escapedString = key.replace(escapeRegex, function(match) { return escaperLookup[match]; }); return "$" + escapedString; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
escape
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function escapeUserProvidedKey(text) { return text.replace(userProvidedKeyEscapeRegex, "$&/"); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
escapeUserProvidedKey
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function getElementKey(element, index) { if (typeof element === "object" && element !== null && element.key != null) { { checkKeyStringCoercion(element.key); } return escape("" + element.key); } return index.toString(36); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
getElementKey
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { var type = typeof children; if (type === "undefined" || type === "boolean") { children = null; } var invokeCallback = false; if (children === null) { invokeCallback = true; } else { switch (type) { case "string": case "number": invokeCallback = true; break; case "object": switch (children.$$typeof) { case REACT_ELEMENT_TYPE: case REACT_PORTAL_TYPE: invokeCallback = true; } } } if (invokeCallback) { var _child = children; var mappedChild = callback(_child); var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar; if (isArray(mappedChild)) { var escapedChildKey = ""; if (childKey != null) { escapedChildKey = escapeUserProvidedKey(childKey) + "/"; } mapIntoArray(mappedChild, array, escapedChildKey, "", function(c) { return c; }); } else if (mappedChild != null) { if (isValidElement(mappedChild)) { { if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) { checkKeyStringCoercion(mappedChild.key); } } mappedChild = cloneAndReplaceKey( mappedChild, // Keep both the (mapped) and old keys if they differ, just as // traverseAllChildren used to do for objects as children escapedPrefix + // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? ( // $FlowFixMe Flow incorrectly thinks existing element's key can be a number // eslint-disable-next-line react-internal/safe-string-coercion escapeUserProvidedKey("" + mappedChild.key) + "/" ) : "") + childKey ); } array.push(mappedChild); } return 1; } var child; var nextName; var subtreeCount = 0; var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR; if (isArray(children)) { for (var i = 0; i < children.length; i++) { child = children[i]; nextName = nextNamePrefix + getElementKey(child, i); subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); } } else { var iteratorFn = getIteratorFn(children); if (typeof iteratorFn === "function") { var iterableChildren = children; { if (iteratorFn === iterableChildren.entries) { if (!didWarnAboutMaps) { warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."); } didWarnAboutMaps = true; } } var iterator = iteratorFn.call(iterableChildren); var step; var ii = 0; while (!(step = iterator.next()).done) { child = step.value; nextName = nextNamePrefix + getElementKey(child, ii++); subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); } } else if (type === "object") { var childrenString = String(children); throw new Error("Objects are not valid as a React child (found: " + (childrenString === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead."); } } return subtreeCount; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
mapIntoArray
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function mapChildren(children, func, context) { if (children == null) { return children; } var result = []; var count = 0; mapIntoArray(children, result, "", "", function(child) { return func.call(context, child, count++); }); return result; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
mapChildren
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function countChildren(children) { var n = 0; mapChildren(children, function() { n++; }); return n; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
countChildren
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function forEachChildren(children, forEachFunc, forEachContext) { mapChildren(children, function() { forEachFunc.apply(this, arguments); }, forEachContext); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
forEachChildren
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function toArray(children) { return mapChildren(children, function(child) { return child; }) || []; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
toArray
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function onlyChild(children) { if (!isValidElement(children)) { throw new Error("React.Children.only expected to receive a single React element child."); } return children; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
onlyChild
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function createContext(defaultValue) { var context = { $$typeof: REACT_CONTEXT_TYPE, // As a workaround to support multiple concurrent renderers, we categorize // some renderers as primary and others as secondary. We only expect // there to be two concurrent renderers at most: React Native (primary) and // Fabric (secondary); React DOM (primary) and React ART (secondary). // Secondary renderers store their context values on separate fields. _currentValue: defaultValue, _currentValue2: defaultValue, // Used to track how many concurrent renderers this context currently // supports within in a single renderer. Such as parallel server rendering. _threadCount: 0, // These are circular Provider: null, Consumer: null, // Add these to use same hidden class in VM as ServerContext _defaultValue: null, _globalName: null }; context.Provider = { $$typeof: REACT_PROVIDER_TYPE, _context: context }; var hasWarnedAboutUsingNestedContextConsumers = false; var hasWarnedAboutUsingConsumerProvider = false; var hasWarnedAboutDisplayNameOnConsumer = false; { var Consumer = { $$typeof: REACT_CONTEXT_TYPE, _context: context }; Object.defineProperties(Consumer, { Provider: { get: function() { if (!hasWarnedAboutUsingConsumerProvider) { hasWarnedAboutUsingConsumerProvider = true; error("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?"); } return context.Provider; }, set: function(_Provider) { context.Provider = _Provider; } }, _currentValue: { get: function() { return context._currentValue; }, set: function(_currentValue) { context._currentValue = _currentValue; } }, _currentValue2: { get: function() { return context._currentValue2; }, set: function(_currentValue2) { context._currentValue2 = _currentValue2; } }, _threadCount: { get: function() { return context._threadCount; }, set: function(_threadCount) { context._threadCount = _threadCount; } }, Consumer: { get: function() { if (!hasWarnedAboutUsingNestedContextConsumers) { hasWarnedAboutUsingNestedContextConsumers = true; error("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?"); } return context.Consumer; } }, displayName: { get: function() { return context.displayName; }, set: function(displayName) { if (!hasWarnedAboutDisplayNameOnConsumer) { warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName); hasWarnedAboutDisplayNameOnConsumer = true; } } } }); context.Consumer = Consumer; } { context._currentRenderer = null; context._currentRenderer2 = null; } return context; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
createContext
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function lazyInitializer(payload) { if (payload._status === Uninitialized) { var ctor = payload._result; var thenable = ctor(); thenable.then(function(moduleObject2) { if (payload._status === Pending || payload._status === Uninitialized) { var resolved = payload; resolved._status = Resolved; resolved._result = moduleObject2; } }, function(error2) { if (payload._status === Pending || payload._status === Uninitialized) { var rejected = payload; rejected._status = Rejected; rejected._result = error2; } }); if (payload._status === Uninitialized) { var pending = payload; pending._status = Pending; pending._result = thenable; } } if (payload._status === Resolved) { var moduleObject = payload._result; { if (moduleObject === void 0) { error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", moduleObject); } } { if (!("default" in moduleObject)) { error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", moduleObject); } } return moduleObject.default; } else { throw payload._result; } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
lazyInitializer
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function lazy(ctor) { var payload = { // We use these fields to store the result. _status: Uninitialized, _result: ctor }; var lazyType = { $$typeof: REACT_LAZY_TYPE, _payload: payload, _init: lazyInitializer }; { var defaultProps; var propTypes; Object.defineProperties(lazyType, { defaultProps: { configurable: true, get: function() { return defaultProps; }, set: function(newDefaultProps) { error("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."); defaultProps = newDefaultProps; Object.defineProperty(lazyType, "defaultProps", { enumerable: true }); } }, propTypes: { configurable: true, get: function() { return propTypes; }, set: function(newPropTypes) { error("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."); propTypes = newPropTypes; Object.defineProperty(lazyType, "propTypes", { enumerable: true }); } } }); } return lazyType; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
lazy
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function forwardRef(render) { { if (render != null && render.$$typeof === REACT_MEMO_TYPE) { error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."); } else if (typeof render !== "function") { error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render); } else { if (render.length !== 0 && render.length !== 2) { error("forwardRef render functions accept exactly two parameters: props and ref. %s", render.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."); } } if (render != null) { if (render.defaultProps != null || render.propTypes != null) { error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"); } } } var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }; { var ownName; Object.defineProperty(elementType, "displayName", { enumerable: false, configurable: true, get: function() { return ownName; }, set: function(name) { ownName = name; if (!render.name && !render.displayName) { render.displayName = name; } } }); } return elementType; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
forwardRef
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function isValidElementType(type) { if (typeof type === "string" || typeof type === "function") { return true; } if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) { return true; } if (typeof type === "object" && type !== null) { if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) { return true; } } return false; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
isValidElementType
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function memo(type, compare) { { if (!isValidElementType(type)) { error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type); } } var elementType = { $$typeof: REACT_MEMO_TYPE, type, compare: compare === void 0 ? null : compare }; { var ownName; Object.defineProperty(elementType, "displayName", { enumerable: false, configurable: true, get: function() { return ownName; }, set: function(name) { ownName = name; if (!type.name && !type.displayName) { type.displayName = name; } } }); } return elementType; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
memo
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function resolveDispatcher() { var dispatcher = ReactCurrentDispatcher.current; { if (dispatcher === null) { error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."); } } return dispatcher; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
resolveDispatcher
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useContext(Context) { var dispatcher = resolveDispatcher(); { if (Context._context !== void 0) { var realContext = Context._context; if (realContext.Consumer === Context) { error("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"); } else if (realContext.Provider === Context) { error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?"); } } } return dispatcher.useContext(Context); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useContext
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useState(initialState) { var dispatcher = resolveDispatcher(); return dispatcher.useState(initialState); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useState
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useReducer(reducer, initialArg, init) { var dispatcher = resolveDispatcher(); return dispatcher.useReducer(reducer, initialArg, init); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useReducer
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useRef(initialValue) { var dispatcher = resolveDispatcher(); return dispatcher.useRef(initialValue); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useRef
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useEffect(create, deps); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useEffect
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useInsertionEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useInsertionEffect(create, deps); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useInsertionEffect
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useLayoutEffect(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useLayoutEffect(create, deps); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useLayoutEffect
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useCallback(callback, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useCallback(callback, deps); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useCallback
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useMemo(create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useMemo(create, deps); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useMemo
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useImperativeHandle(ref, create, deps) { var dispatcher = resolveDispatcher(); return dispatcher.useImperativeHandle(ref, create, deps); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useImperativeHandle
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useDebugValue(value, formatterFn) { { var dispatcher = resolveDispatcher(); return dispatcher.useDebugValue(value, formatterFn); } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useDebugValue
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useTransition() { var dispatcher = resolveDispatcher(); return dispatcher.useTransition(); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useTransition
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useDeferredValue(value) { var dispatcher = resolveDispatcher(); return dispatcher.useDeferredValue(value); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useDeferredValue
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useId() { var dispatcher = resolveDispatcher(); return dispatcher.useId(); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useId
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { var dispatcher = resolveDispatcher(); return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
useSyncExternalStore
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function disableLogs() { { if (disabledDepth === 0) { prevLog = console.log; prevInfo = console.info; prevWarn = console.warn; prevError = console.error; prevGroup = console.group; prevGroupCollapsed = console.groupCollapsed; prevGroupEnd = console.groupEnd; var props = { configurable: true, enumerable: true, value: disabledLog, writable: true }; Object.defineProperties(console, { info: props, log: props, warn: props, error: props, group: props, groupCollapsed: props, groupEnd: props }); } disabledDepth++; } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
disableLogs
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function reenableLogs() { { disabledDepth--; if (disabledDepth === 0) { var props = { configurable: true, enumerable: true, writable: true }; Object.defineProperties(console, { log: assign({}, props, { value: prevLog }), info: assign({}, props, { value: prevInfo }), warn: assign({}, props, { value: prevWarn }), error: assign({}, props, { value: prevError }), group: assign({}, props, { value: prevGroup }), groupCollapsed: assign({}, props, { value: prevGroupCollapsed }), groupEnd: assign({}, props, { value: prevGroupEnd }) }); } if (disabledDepth < 0) { error("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
reenableLogs
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function describeBuiltInComponentFrame(name, source, ownerFn) { { if (prefix === void 0) { try { throw Error(); } catch (x) { var match = x.stack.trim().match(/\n( *(at )?)/); prefix = match && match[1] || ""; } } return "\n" + prefix + name; } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
describeBuiltInComponentFrame
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function describeNativeComponentFrame(fn, construct) { if (!fn || reentry) { return ""; } { var frame = componentFrameCache.get(fn); if (frame !== void 0) { return frame; } } var control; reentry = true; var previousPrepareStackTrace = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var previousDispatcher; { previousDispatcher = ReactCurrentDispatcher$1.current; ReactCurrentDispatcher$1.current = null; disableLogs(); } try { if (construct) { var Fake = function() { throw Error(); }; Object.defineProperty(Fake.prototype, "props", { set: function() { throw Error(); } }); if (typeof Reflect === "object" && Reflect.construct) { try { Reflect.construct(Fake, []); } catch (x) { control = x; } Reflect.construct(fn, [], Fake); } else { try { Fake.call(); } catch (x) { control = x; } fn.call(Fake.prototype); } } else { try { throw Error(); } catch (x) { control = x; } fn(); } } catch (sample) { if (sample && control && typeof sample.stack === "string") { var sampleLines = sample.stack.split("\n"); var controlLines = control.stack.split("\n"); var s = sampleLines.length - 1; var c = controlLines.length - 1; while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { c--; } for (; s >= 1 && c >= 0; s--, c--) { if (sampleLines[s] !== controlLines[c]) { if (s !== 1 || c !== 1) { do { s--; c--; if (c < 0 || sampleLines[s] !== controlLines[c]) { var _frame = "\n" + sampleLines[s].replace(" at new ", " at "); if (fn.displayName && _frame.includes("<anonymous>")) { _frame = _frame.replace("<anonymous>", fn.displayName); } { if (typeof fn === "function") { componentFrameCache.set(fn, _frame); } } return _frame; } } while (s >= 1 && c >= 0); } break; } } } } finally { reentry = false; { ReactCurrentDispatcher$1.current = previousDispatcher; reenableLogs(); } Error.prepareStackTrace = previousPrepareStackTrace; } var name = fn ? fn.displayName || fn.name : ""; var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ""; { if (typeof fn === "function") { componentFrameCache.set(fn, syntheticFrame); } } return syntheticFrame; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
describeNativeComponentFrame
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
Fake = function() { throw Error(); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
Fake
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function describeFunctionComponentFrame(fn, source, ownerFn) { { return describeNativeComponentFrame(fn, false); } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
describeFunctionComponentFrame
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function shouldConstruct(Component2) { var prototype = Component2.prototype; return !!(prototype && prototype.isReactComponent); }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
shouldConstruct
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { if (type == null) { return ""; } if (typeof type === "function") { { return describeNativeComponentFrame(type, shouldConstruct(type)); } } if (typeof type === "string") { return describeBuiltInComponentFrame(type); } switch (type) { case REACT_SUSPENSE_TYPE: return describeBuiltInComponentFrame("Suspense"); case REACT_SUSPENSE_LIST_TYPE: return describeBuiltInComponentFrame("SuspenseList"); } if (typeof type === "object") { switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: return describeFunctionComponentFrame(type.render); case REACT_MEMO_TYPE: return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); case REACT_LAZY_TYPE: { var lazyComponent = type; var payload = lazyComponent._payload; var init = lazyComponent._init; try { return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); } catch (x) { } } } } return ""; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
describeUnknownElementTypeFrameInDEV
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function setCurrentlyValidatingElement(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); ReactDebugCurrentFrame$1.setExtraStackFrame(stack); } else { ReactDebugCurrentFrame$1.setExtraStackFrame(null); } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
setCurrentlyValidatingElement
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function checkPropTypes(typeSpecs, values, location, componentName, element) { { var has = Function.call.bind(hasOwnProperty); for (var typeSpecName in typeSpecs) { if (has(typeSpecs, typeSpecName)) { var error$1 = void 0; try { if (typeof typeSpecs[typeSpecName] !== "function") { var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); err.name = "Invariant Violation"; throw err; } error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (ex) { error$1 = ex; } if (error$1 && !(error$1 instanceof Error)) { setCurrentlyValidatingElement(element); error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1); setCurrentlyValidatingElement(null); } if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { loggedTypeFailures[error$1.message] = true; setCurrentlyValidatingElement(element); error("Failed %s type: %s", location, error$1.message); setCurrentlyValidatingElement(null); } } } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
checkPropTypes
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function setCurrentlyValidatingElement$1(element) { { if (element) { var owner = element._owner; var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); setExtraStackFrame(stack); } else { setExtraStackFrame(null); } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
setCurrentlyValidatingElement$1
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function getDeclarationErrorAddendum() { if (ReactCurrentOwner.current) { var name = getComponentNameFromType(ReactCurrentOwner.current.type); if (name) { return "\n\nCheck the render method of `" + name + "`."; } } return ""; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
getDeclarationErrorAddendum
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function getSourceInfoErrorAddendum(source) { if (source !== void 0) { var fileName = source.fileName.replace(/^.*[\\\/]/, ""); var lineNumber = source.lineNumber; return "\n\nCheck your code at " + fileName + ":" + lineNumber + "."; } return ""; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
getSourceInfoErrorAddendum
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function getSourceInfoErrorAddendumForProps(elementProps) { if (elementProps !== null && elementProps !== void 0) { return getSourceInfoErrorAddendum(elementProps.__source); } return ""; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
getSourceInfoErrorAddendumForProps
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function getCurrentComponentErrorInfo(parentType) { var info = getDeclarationErrorAddendum(); if (!info) { var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name; if (parentName) { info = "\n\nCheck the top-level render call using <" + parentName + ">."; } } return info; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
getCurrentComponentErrorInfo
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function validateExplicitKey(element, parentType) { if (!element._store || element._store.validated || element.key != null) { return; } element._store.validated = true; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { return; } ownerHasKeyUseWarning[currentComponentErrorInfo] = true; var childOwner = ""; if (element && element._owner && element._owner !== ReactCurrentOwner.current) { childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; } { setCurrentlyValidatingElement$1(element); error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); setCurrentlyValidatingElement$1(null); } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
validateExplicitKey
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function validateChildKeys(node, parentType) { if (typeof node !== "object") { return; } if (isArray(node)) { for (var i = 0; i < node.length; i++) { var child = node[i]; if (isValidElement(child)) { validateExplicitKey(child, parentType); } } } else if (isValidElement(node)) { if (node._store) { node._store.validated = true; } } else if (node) { var iteratorFn = getIteratorFn(node); if (typeof iteratorFn === "function") { if (iteratorFn !== node.entries) { var iterator = iteratorFn.call(node); var step; while (!(step = iterator.next()).done) { if (isValidElement(step.value)) { validateExplicitKey(step.value, parentType); } } } } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
validateChildKeys
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function validatePropTypes(element) { { var type = element.type; if (type === null || type === void 0 || typeof type === "string") { return; } var propTypes; if (typeof type === "function") { propTypes = type.propTypes; } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. type.$$typeof === REACT_MEMO_TYPE)) { propTypes = type.propTypes; } else { return; } if (propTypes) { var name = getComponentNameFromType(type); checkPropTypes(propTypes, element.props, "prop", name, element); } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) { propTypesMisspellWarningShown = true; var _name = getComponentNameFromType(type); error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown"); } if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) { error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
validatePropTypes
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function validateFragmentProps(fragment) { { var keys = Object.keys(fragment.props); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (key !== "children" && key !== "key") { setCurrentlyValidatingElement$1(fragment); error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key); setCurrentlyValidatingElement$1(null); break; } } if (fragment.ref !== null) { setCurrentlyValidatingElement$1(fragment); error("Invalid attribute `ref` supplied to `React.Fragment`."); setCurrentlyValidatingElement$1(null); } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
validateFragmentProps
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function createElementWithValidation(type, props, children) { var validType = isValidElementType(type); if (!validType) { var info = ""; if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) { info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."; } var sourceInfo = getSourceInfoErrorAddendumForProps(props); if (sourceInfo) { info += sourceInfo; } else { info += getDeclarationErrorAddendum(); } var typeString; if (type === null) { typeString = "null"; } else if (isArray(type)) { typeString = "array"; } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) { typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />"; info = " Did you accidentally export a JSX literal instead of a component?"; } else { typeString = typeof type; } { error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info); } } var element = createElement.apply(this, arguments); if (element == null) { return element; } if (validType) { for (var i = 2; i < arguments.length; i++) { validateChildKeys(arguments[i], type); } } if (type === REACT_FRAGMENT_TYPE) { validateFragmentProps(element); } else { validatePropTypes(element); } return element; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
createElementWithValidation
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function createFactoryWithValidation(type) { var validatedFactory = createElementWithValidation.bind(null, type); validatedFactory.type = type; { if (!didWarnAboutDeprecatedCreateFactory) { didWarnAboutDeprecatedCreateFactory = true; warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead."); } Object.defineProperty(validatedFactory, "type", { enumerable: false, get: function() { warn("Factory.type is deprecated. Access the class directly before passing it to createFactory."); Object.defineProperty(this, "type", { value: type }); return type; } }); } return validatedFactory; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
createFactoryWithValidation
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function cloneElementWithValidation(element, props, children) { var newElement = cloneElement.apply(this, arguments); for (var i = 2; i < arguments.length; i++) { validateChildKeys(arguments[i], newElement.type); } validatePropTypes(newElement); return newElement; }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
cloneElementWithValidation
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT
function startTransition(scope, options) { var prevTransition = ReactCurrentBatchConfig.transition; ReactCurrentBatchConfig.transition = {}; var currentTransition = ReactCurrentBatchConfig.transition; { ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set(); } try { scope(); } finally { ReactCurrentBatchConfig.transition = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { var updatedFibersCount = currentTransition._updatedFibers.size; if (updatedFibersCount > 10) { warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."); } currentTransition._updatedFibers.clear(); } } } }
Sets a subset of the state. This only exists because _pendingState is internal. This provides a merging strategy that is not available to deep properties which is confusing. TODO: Expose pendingState or don't use it during the merge. @param {ReactClass} publicInstance The instance that should rerender. @param {object} partialState Next partial state to be merged with state. @param {?function} callback Called after component is updated. @param {?string} Name of the calling function in the public API. @internal
startTransition
javascript
wasmerio/winterjs
benchmark/complex.js
https://github.com/wasmerio/winterjs/blob/master/benchmark/complex.js
MIT