Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
search-page
Commits
6cc198bf
Commit
6cc198bf
authored
Dec 26, 2020
by
Sangjune Bae
Browse files
first commit
parent
81c6da4b
Changes
760
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
760 of 760+
files are displayed.
Plain diff
Email patch
node_modules/@restart/hooks/esm/useTimeout.js
0 → 100644
View file @
6cc198bf
import
{
useMemo
,
useRef
}
from
'
react
'
;
import
useMounted
from
'
./useMounted
'
;
import
useWillUnmount
from
'
./useWillUnmount
'
;
/*
* Browsers including Internet Explorer, Chrome, Safari, and Firefox store the
* delay as a 32-bit signed integer internally. This causes an integer overflow
* when using delays larger than 2,147,483,647 ms (about 24.8 days),
* resulting in the timeout being executed immediately.
*
* via: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout
*/
var
MAX_DELAY_MS
=
Math
.
pow
(
2
,
31
)
-
1
;
function
setChainedTimeout
(
handleRef
,
fn
,
timeoutAtMs
)
{
var
delayMs
=
timeoutAtMs
-
Date
.
now
();
handleRef
.
current
=
delayMs
<=
MAX_DELAY_MS
?
setTimeout
(
fn
,
delayMs
)
:
setTimeout
(
function
()
{
return
setChainedTimeout
(
handleRef
,
fn
,
timeoutAtMs
);
},
MAX_DELAY_MS
);
}
/**
* Returns a controller object for setting a timeout that is properly cleaned up
* once the component unmounts. New timeouts cancel and replace existing ones.
*/
export
default
function
useTimeout
()
{
var
isMounted
=
useMounted
();
// types are confused between node and web here IDK
var
handleRef
=
useRef
();
useWillUnmount
(
function
()
{
return
clearTimeout
(
handleRef
.
current
);
});
return
useMemo
(
function
()
{
var
clear
=
function
clear
()
{
return
clearTimeout
(
handleRef
.
current
);
};
function
set
(
fn
,
delayMs
)
{
if
(
delayMs
===
void
0
)
{
delayMs
=
0
;
}
if
(
!
isMounted
())
return
;
clear
();
if
(
delayMs
<=
MAX_DELAY_MS
)
{
// For simplicity, if the timeout is short, just set a normal timeout.
handleRef
.
current
=
setTimeout
(
fn
,
delayMs
);
}
else
{
setChainedTimeout
(
handleRef
,
fn
,
Date
.
now
()
+
delayMs
);
}
}
return
{
set
:
set
,
clear
:
clear
};
},
[]);
}
\ No newline at end of file
node_modules/@restart/hooks/esm/useUpdateEffect.d.ts
0 → 100644
View file @
6cc198bf
import
{
EffectCallback
,
DependencyList
}
from
'
react
'
;
/**
* Runs an effect only when the dependencies have changed, skipping the
* initial "on mount" run. Caution, if the dependency list never changes,
* the effect is **never run**
*
* ```ts
* const ref = useRef<HTMLInput>(null);
*
* // focuses an element only if the focus changes, and not on mount
* useUpdateEffect(() => {
* const element = ref.current?.children[focusedIdx] as HTMLElement
*
* element?.focus()
*
* }, [focusedIndex])
* ```
* @param effect An effect to run on mount
*
* @category effects
*/
declare
function
useUpdateEffect
(
fn
:
EffectCallback
,
deps
:
DependencyList
):
void
;
export
default
useUpdateEffect
;
node_modules/@restart/hooks/esm/useUpdateEffect.js
0 → 100644
View file @
6cc198bf
import
{
useEffect
,
useRef
}
from
'
react
'
;
/**
* Runs an effect only when the dependencies have changed, skipping the
* initial "on mount" run. Caution, if the dependency list never changes,
* the effect is **never run**
*
* ```ts
* const ref = useRef<HTMLInput>(null);
*
* // focuses an element only if the focus changes, and not on mount
* useUpdateEffect(() => {
* const element = ref.current?.children[focusedIdx] as HTMLElement
*
* element?.focus()
*
* }, [focusedIndex])
* ```
* @param effect An effect to run on mount
*
* @category effects
*/
function
useUpdateEffect
(
fn
,
deps
)
{
var
isFirst
=
useRef
(
true
);
useEffect
(
function
()
{
if
(
isFirst
.
current
)
{
isFirst
.
current
=
false
;
return
;
}
return
fn
();
},
deps
);
}
export
default
useUpdateEffect
;
\ No newline at end of file
node_modules/@restart/hooks/esm/useUpdatedRef.d.ts
0 → 100644
View file @
6cc198bf
/// <reference types="react" />
/**
* Returns a ref that is immediately updated with the new value
*
* @param value The Ref value
* @category refs
*/
export
default
function
useUpdatedRef
<
T
>
(
value
:
T
):
import
(
"
react
"
).
MutableRefObject
<
T
>
;
node_modules/@restart/hooks/esm/useUpdatedRef.js
0 → 100644
View file @
6cc198bf
import
{
useRef
}
from
'
react
'
;
/**
* Returns a ref that is immediately updated with the new value
*
* @param value The Ref value
* @category refs
*/
export
default
function
useUpdatedRef
(
value
)
{
var
valueRef
=
useRef
(
value
);
valueRef
.
current
=
value
;
return
valueRef
;
}
\ No newline at end of file
node_modules/@restart/hooks/esm/useWillUnmount.d.ts
0 → 100644
View file @
6cc198bf
/**
* Attach a callback that fires when a component unmounts
*
* @param fn Handler to run when the component unmounts
* @category effects
*/
export
default
function
useWillUnmount
(
fn
:
()
=>
void
):
void
;
node_modules/@restart/hooks/esm/useWillUnmount.js
0 → 100644
View file @
6cc198bf
import
useUpdatedRef
from
'
./useUpdatedRef
'
;
import
{
useEffect
}
from
'
react
'
;
/**
* Attach a callback that fires when a component unmounts
*
* @param fn Handler to run when the component unmounts
* @category effects
*/
export
default
function
useWillUnmount
(
fn
)
{
var
onUnmount
=
useUpdatedRef
(
fn
);
useEffect
(
function
()
{
return
function
()
{
return
onUnmount
.
current
();
};
},
[]);
}
\ No newline at end of file
node_modules/@restart/hooks/package.json
0 → 100644
View file @
6cc198bf
{
"_from"
:
"@restart/hooks@^0.3.21"
,
"_id"
:
"@restart/hooks@0.3.25"
,
"_inBundle"
:
false
,
"_integrity"
:
"sha512-m2v3N5pxTsIiSH74/sb1yW8D9RxkJidGW+5Mfwn/lHb2QzhZNlaU1su7abSyT9EGf0xS/0waLjrf7/XxQHUk7w=="
,
"_location"
:
"/@restart/hooks"
,
"_phantomChildren"
:
{},
"_requested"
:
{
"type"
:
"range"
,
"registry"
:
true
,
"raw"
:
"@restart/hooks@^0.3.21"
,
"name"
:
"@restart/hooks"
,
"escapedName"
:
"@restart%2fhooks"
,
"scope"
:
"@restart"
,
"rawSpec"
:
"^0.3.21"
,
"saveSpec"
:
null
,
"fetchSpec"
:
"^0.3.21"
},
"_requiredBy"
:
[
"/react-bootstrap"
,
"/react-overlays"
],
"_resolved"
:
"https://registry.npmjs.org/@restart/hooks/-/hooks-0.3.25.tgz"
,
"_shasum"
:
"11004139ad1c70d2f5965a8939dcb5aeb96aa652"
,
"_spec"
:
"@restart/hooks@^0.3.21"
,
"_where"
:
"C:
\\
Users
\\
reyel
\\
OneDrive
\\
바탕 화면
\\
2020winter
\\
search-page
\\
node_modules
\\
react-bootstrap"
,
"author"
:
{
"name"
:
"Jason Quense"
,
"email"
:
"monastic.panic@gmail.com"
},
"bugs"
:
{
"url"
:
"https://github.com/react-restart/hooks/issues"
},
"bundleDependencies"
:
false
,
"dependencies"
:
{
"lodash"
:
"^4.17.15"
,
"lodash-es"
:
"^4.17.15"
},
"deprecated"
:
false
,
"homepage"
:
"https://github.com/react-restart/hooks#readme"
,
"jest"
:
{
"preset"
:
"@4c"
,
"rootDir"
:
"./test"
,
"setupFilesAfterEnv"
:
[
"./setup.js"
]
},
"license"
:
"MIT"
,
"main"
:
"cjs/index.js"
,
"module"
:
"esm/index.js"
,
"name"
:
"@restart/hooks"
,
"peerDependencies"
:
{
"react"
:
"^16.8.0"
},
"prettier"
:
{
"singleQuote"
:
true
,
"semi"
:
false
,
"trailingComma"
:
"all"
},
"publishConfig"
:
{
"access"
:
"public"
,
"directory"
:
"lib"
},
"release"
:
{
"conventionalCommits"
:
true
},
"repository"
:
{
"type"
:
"git"
,
"url"
:
"git+https://github.com/jquense/react-common-hooks.git"
},
"types"
:
"cjs/index.d.ts"
,
"version"
:
"0.3.25"
}
node_modules/@restart/hooks/useAnimationFrame/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useAnimationFrame"
,
"private"
:
true
,
"main"
:
"../cjs/useAnimationFrame.js"
,
"module"
:
"../esm/useAnimationFrame.js"
,
"types"
:
"../esm/useAnimationFrame.d.ts"
}
node_modules/@restart/hooks/useBreakpoint/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useBreakpoint"
,
"private"
:
true
,
"main"
:
"../cjs/useBreakpoint.js"
,
"module"
:
"../esm/useBreakpoint.js"
,
"types"
:
"../esm/useBreakpoint.d.ts"
}
node_modules/@restart/hooks/useCallbackRef/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useCallbackRef"
,
"private"
:
true
,
"main"
:
"../cjs/useCallbackRef.js"
,
"module"
:
"../esm/useCallbackRef.js"
,
"types"
:
"../esm/useCallbackRef.d.ts"
}
node_modules/@restart/hooks/useCommittedRef/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useCommittedRef"
,
"private"
:
true
,
"main"
:
"../cjs/useCommittedRef.js"
,
"module"
:
"../esm/useCommittedRef.js"
,
"types"
:
"../esm/useCommittedRef.d.ts"
}
node_modules/@restart/hooks/useCustomEffect/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useCustomEffect"
,
"private"
:
true
,
"main"
:
"../cjs/useCustomEffect.js"
,
"module"
:
"../esm/useCustomEffect.js"
,
"types"
:
"../esm/useCustomEffect.d.ts"
}
node_modules/@restart/hooks/useEventCallback/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useEventCallback"
,
"private"
:
true
,
"main"
:
"../cjs/useEventCallback.js"
,
"module"
:
"../esm/useEventCallback.js"
,
"types"
:
"../esm/useEventCallback.d.ts"
}
node_modules/@restart/hooks/useEventListener/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useEventListener"
,
"private"
:
true
,
"main"
:
"../cjs/useEventListener.js"
,
"module"
:
"../esm/useEventListener.js"
,
"types"
:
"../esm/useEventListener.d.ts"
}
node_modules/@restart/hooks/useFocusManager/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useFocusManager"
,
"private"
:
true
,
"main"
:
"../cjs/useFocusManager.js"
,
"module"
:
"../esm/useFocusManager.js"
,
"types"
:
"../esm/useFocusManager.d.ts"
}
node_modules/@restart/hooks/useForceUpdate/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useForceUpdate"
,
"private"
:
true
,
"main"
:
"../cjs/useForceUpdate.js"
,
"module"
:
"../esm/useForceUpdate.js"
,
"types"
:
"../esm/useForceUpdate.d.ts"
}
node_modules/@restart/hooks/useGlobalListener/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useGlobalListener"
,
"private"
:
true
,
"main"
:
"../cjs/useGlobalListener.js"
,
"module"
:
"../esm/useGlobalListener.js"
,
"types"
:
"../esm/useGlobalListener.d.ts"
}
node_modules/@restart/hooks/useImage/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useImage"
,
"private"
:
true
,
"main"
:
"../cjs/useImage.js"
,
"module"
:
"../esm/useImage.js"
,
"types"
:
"../esm/useImage.d.ts"
}
node_modules/@restart/hooks/useImmediateUpdateEffect/package.json
0 → 100644
View file @
6cc198bf
{
"name"
:
"@restart/hooks/useImmediateUpdateEffect"
,
"private"
:
true
,
"main"
:
"../cjs/useImmediateUpdateEffect.js"
,
"module"
:
"../esm/useImmediateUpdateEffect.js"
,
"types"
:
"../esm/useImmediateUpdateEffect.d.ts"
}
Prev
1
…
28
29
30
31
32
33
34
35
36
…
38
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment