const _loadLib = async function(_location) {
/* Initialize ZeroCDN public key. */
const zerocdn = '1ZCDN4UGGVmhRd29DrVVW7vNsbmMvfrr3'
/* Retrieve the library data (using ZeroApi). */
const libData = await ZeroApi.cmd('fileGet', [`cors-${zerocdn}/libs/${_location}`])
/* Evaluate (execute) JS library data (in global scope). */
eval(libData) // FIXME Is there possibly anything "safer" than eval??
}
const init = async function () {
await _loadLib('moment/2.22.2/js/moment.min.js')
await _loadLib('numeral/2.0.6/js/numeral.min.js')
/* Test injected libraries. */
const epoch = moment().unix()
const formatted = numeral(epoch).format('0,0')
console.log(`Epoch is [ ${epoch} / ${formatted} ]`)
}
init()
forked from d14na/zerocdn
-
Notifications
You must be signed in to change notification settings - Fork 0
Fastest content delivery on planet earth. Guaranteed.
License
MoriEdan/zerocdn
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Fastest content delivery on planet earth. Guaranteed.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- JavaScript 54.2%
- HTML 45.8%