Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Basthon
Basthon Kernel
Commits
d2651022
Commit
d2651022
authored
Jan 02, 2021
by
Romain Casati
Browse files
Support requirejs import.
parent
34c75091
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/basthon.js
View file @
d2651022
'
use strict
'
;
(
function
(
root
,
factory
)
{
// requirejs?
if
(
typeof
define
===
'
function
'
)
{
define
([
'
module
'
],
factory
);
// TypeScript?
}
else
if
(
typeof
exports
===
'
object
'
)
{
module
.
exports
=
factory
();
// default goes to global namespace
}
else
{
root
.
Basthon
=
factory
();
}
}(
this
,
function
(
module
)
{
'
use strict
'
;
/**
* Using the namespace design pattern.
*/
var
Basthon
=
(
function
()
{
let
that
=
{};
/**
...
...
@@ -26,7 +34,14 @@ var Basthon = (function() {
/**
* Get the URL of the current script (usefull for serving basthon.py.js)
*/
that
.
urlScript
=
document
.
currentScript
.
src
;
that
.
urlScript
=
(
function
()
{
if
(
module
!=
null
)
{
let
url
=
window
.
location
.
origin
+
window
.
location
.
pathname
;
url
=
url
.
substring
(
0
,
url
.
lastIndexOf
(
'
/
'
))
+
"
/
"
;
return
url
+
module
.
uri
;
}
else
return
document
.
currentScript
.
src
;
})();
/**
* Get the URL of Basthon kernel root dir.
...
...
@@ -473,4 +488,4 @@ var Basthon = (function() {
};
return
that
;
})
(
);
}));
src/basthon_goodies.js
View file @
d2651022
'
use strict
'
;
(
function
(
root
,
factory
)
{
// requirejs?
if
(
typeof
define
===
'
function
'
)
{
define
([
'
./basthon
'
],
factory
);
// TypeScript?
}
else
if
(
typeof
exports
===
'
object
'
)
{
module
.
exports
=
factory
();
// default goes to global namespace
}
else
{
root
.
Basthon
.
Goodies
=
factory
(
root
.
Basthon
);
}
}(
this
,
function
(
Basthon
)
{
'
use strict
'
;
/**
* Using the namespace design pattern.
*/
Basthon
.
Goodies
=
(
function
()
{
let
that
=
{};
/**
...
...
@@ -107,4 +115,4 @@ Basthon.Goodies = (function() {
};
return
that
;
})
(
);
}));
Write
Preview
Supports
Markdown
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