Last active
December 15, 2019 13:13
-
-
Save EduApps-CDG/1546229bca45528a36b55ecd99f9a2c3 to your computer and use it in GitHub Desktop.
A <script> linker made in JavaScript.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright 2019 EduApps (Eduardo P. Gomez) | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
var Importer = { | |
help: function() { | |
console.log("Importer.js V1.0.0 by EduApps\n<> - needed variable.\n[] - not needed variable.\n\ncommands:\n help - show this help message()\n imports - import a script/module(<url>,[onAppend],[type])"); | |
}, | |
imports: function(url, onAppend, type) { | |
if (type === null) { | |
type = "text/javascript"; | |
} | |
var script = document.createElement("script"); | |
script.src = url; | |
script.type = type; | |
document.body.appendChild(script); | |
if (onAppend !== null) { | |
onAppend(); | |
} | |
return script; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright 2019 EduApps (Eduardo P. Gomez) | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
var Importer={help:function(){console.log("Importer.js V1.0.0 by EduApps\n<> - needed variable.\n[] - not needed variable.\n\ncommands:\n help - show this help message()\n imports - import a script/module(<url>,[onAppend],[type])")},imports:function(e,n,t){null===t&&(t="text/javascript");var p=document.createElement("script");return p.src=e,p.type=t,document.body.appendChild(p),null!==n&&n(),p}}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use:
Simple:
More complex:
still need help? try execute
Importer.help()
on the JavaScript Console.