Skip to content
/ UMbed Public
forked from DiscoveryMap/UMbed

Universal eMBED of JavaScript code in third party sites

License

Notifications You must be signed in to change notification settings

TOBUJI/UMbed

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UMbed.js

Universal embedding (U-M-BED) of JavaScript code in third party sites.

Overview

UMbed is a small JavaScript loader designed for embedding your JavaScript code in third party sites or environments, especially if you are using common JavaScript libraries which may already be loaded or cached in the target environment and you want to take advantage of that fact.

If you've developed a self-contained, stand-alone piece of JavaScript to be included in a third party site, implementing a UMD (Universal Module Descriptor) would be more appropriate and achieve the same result with far less overhead (esp. since many JavaScript tools will convert code to a UMD for you).

However, if you rely on common JavaScript libraries and/or modules, and need your code to load into environments which may be using any of many module loading methods (e.g. AMD, CommonJS, etc.), then UMbed will bootstrap your code using any existing loader (or none) and existing modules/libraries (if present), ensuring that the requirements of your code are available prior to it running. It also usually requires very minimal code to be inserted into the target site, greatly improving both ease of embedding and performance.

Features & Benefits

  • Minified embed JavaScript code:
    • Small footprint & fast parsing
    • Easily pasted anywhere in HTML page(s)
    • Queues calls to UMbed() for execution if UMbed.js hasn't loaded yet (à la Google Analytics)
  • Bootstrap loader takes advantage of any available module loader:
    • Includes required JavaScript files using any available module loader to prevent conflicts (e.g. RequireJS Common Errors: Mismatched Anonymous Define() Modules…)
    • Loads all prerequisite resources asynchronously, reducing delays in page load & rendering
    • Specify prerequisite JavaScript modules, libraries, variables, and resources (incl. CSS) once
      • They'll automatically be translated for any module loader
      • You can even require that prerequisite variables exist
    • Ideal for use with large, popular JavaScript libraries
      • Take advantage of CDNs & browser caching
      • Reduce the size of your own code base to improve parsing performance
    • Only executes callback code upon completion of loading all prerequisite JavaScript
      • Relies on module loaders (if any) to guarantee this
      • Uses Promises if no module loader is available (i.e. browser globals)
    • Supports JavaScript environments with or without module loaders:

Download & Changelog

Note: While forked from production code, this software is currently in pre-release (hence the 0.x version numbers) and should be thoroughly tested before using.

Please download the latest version from the releases page.

Feel free to peruse the CHANGELOG, if you're into that sort of thing.

How to Get Started

TBD

Resources

Copyright & Support

The original code for this project was developed under contract for Discovery Map International and split out into an open source project under the MIT license by permission. See LICENSE for full details.

Discovery Map International does not have the resources necessary to provide support for this project. Volunteer support is provided by developers in their spare time, so any assistance in improving & maintaining the project is welcome (see CONTRIBUTING).

About

Universal eMBED of JavaScript code in third party sites

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 90.1%
  • HTML 9.9%