Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
getrandom
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
felixmoebius
getrandom
Commits
ec4a3e1f
Commit
ec4a3e1f
authored
4 years ago
by
Pauan
Committed by
Joe Richey
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fixing Webpack require warning
parent
7bfdabf3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
custom/wasm-bindgen/src/lib.rs
+9
-4
9 additions, 4 deletions
custom/wasm-bindgen/src/lib.rs
with
9 additions
and
4 deletions
custom/wasm-bindgen/src/lib.rs
+
9
−
4
View file @
ec4a3e1f
...
@@ -76,7 +76,7 @@ fn getrandom_init() -> Result<RngSource, Error> {
...
@@ -76,7 +76,7 @@ fn getrandom_init() -> Result<RngSource, Error> {
return
Ok
(
RngSource
::
Browser
(
crypto
));
return
Ok
(
RngSource
::
Browser
(
crypto
));
}
}
return
Ok
(
RngSource
::
Node
(
node_
require
(
"crypto"
)));
return
Ok
(
RngSource
::
Node
(
MODULE
.
require
(
"crypto"
)));
}
}
#[wasm_bindgen]
#[wasm_bindgen]
...
@@ -102,12 +102,17 @@ extern "C" {
...
@@ -102,12 +102,17 @@ extern "C" {
#[wasm_bindgen(method,
js_name
=
getRandomValues,
structural)]
#[wasm_bindgen(method,
js_name
=
getRandomValues,
structural)]
fn
get_random_values
(
me
:
&
BrowserCrypto
,
buf
:
&
mut
[
u8
]);
fn
get_random_values
(
me
:
&
BrowserCrypto
,
buf
:
&
mut
[
u8
]);
#[wasm_bindgen(js_name
=
require)]
fn
node_require
(
s
:
&
str
)
->
NodeCrypto
;
#[derive(Clone,
Debug)]
#[derive(Clone,
Debug)]
type
NodeCrypto
;
type
NodeCrypto
;
#[wasm_bindgen(method,
js_name
=
randomFillSync,
structural)]
#[wasm_bindgen(method,
js_name
=
randomFillSync,
structural)]
fn
random_fill_sync
(
me
:
&
NodeCrypto
,
buf
:
&
mut
[
u8
]);
fn
random_fill_sync
(
me
:
&
NodeCrypto
,
buf
:
&
mut
[
u8
]);
type
NodeModule
;
#[wasm_bindgen(js_name
=
module)]
static
MODULE
:
NodeModule
;
#[wasm_bindgen(method)]
fn
require
(
this
:
&
NodeModule
,
s
:
&
str
)
->
NodeCrypto
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment