Skip to content
forked from d14na/zerocdn

Fastest content delivery on planet earth. Guaranteed.

License

Notifications You must be signed in to change notification settings

MoriEdan/zerocdn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZeroCDN

Fastest content delivery on planet earth. Guaranteed.

Quick Usage Example

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()

About

Fastest content delivery on planet earth. Guaranteed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 54.2%
  • HTML 45.8%