Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Olm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
Olm
Commits
f0bb8e03
Commit
f0bb8e03
authored
9 years ago
by
Mark Haines
Browse files
Options
Downloads
Patches
Plain Diff
More fixes to the javascript bindings to get them to behave with browserify
parent
970fc60f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
javascript/olm_pre.js
+10
-6
10 additions, 6 deletions
javascript/olm_pre.js
with
10 additions
and
6 deletions
javascript/olm_pre.js
+
10
−
6
View file @
f0bb8e03
var
olm_exports
=
{};
var
get_random_values
;
if
(
typeof
(
window
)
!==
'
undefined
'
)
{
// We've been imported directly into a browser.
window
[
"
Olm
"
]
=
olm_exports
;
var
process
;
// Shadow the process object so that emscripten won't get
// confused by browserify
if
(
global
&&
global
.
window
)
{
// We're running with browserify
module
[
"
exports
"
]
=
olm_exports
;
global
.
window
[
"
Olm
"
]
=
olm_exports
;
get_random_values
=
function
(
buf
)
{
window
.
crypto
.
getRandomValues
(
buf
);
};
}
else
if
(
global
.
window
)
{
// We'
re running with
browser
ify
global
.
window
[
"
Olm
"
]
=
olm_exports
;
}
else
if
(
typeof
(
window
)
!==
'
undefined
'
)
{
// We'
ve been imported directly into a
browser
.
window
[
"
Olm
"
]
=
olm_exports
;
get_random_values
=
function
(
buf
)
{
window
.
crypto
.
getRandomValues
(
buf
);
};
...
...
@@ -20,6 +23,7 @@ if (typeof(window) !== 'undefined') {
var
bytes
=
nodeCrypto
.
randomBytes
(
buf
.
length
);
buf
.
set
(
bytes
);
}
process
=
global
.
process
;
}
else
{
throw
new
Error
(
"
Cannot find global to attach library to
"
);
}
...
...
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