Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-amd

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-amd

Isolated amd loader replacement

  • 0.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

simple-amd

AMD loader for isolated module environment

Motivation

If you need some module system which does not touch anything in your desk, this would be a good choice.

Compared with r.js, our loader provides following things

  • Isolated loader system
    r.js declares shared module system, so it cannot hide some of your module from others.
  • In-house loader plugin we're trying to make simple-amd to use r.js loader plugins, additionally some loader plugins are included that helps to get data from pouchdb. we also welcome plugin suggestion, please file an issue if needed.

Usage

const Loader = require('simple-amd').Loader;
const React = require('react'); // module to be exposed to your module system.

const loader = new Loader({});
loader.define('react', [], () => React);
loader.require('react', (React) => { ... });

To use loader with default plugins, use default-loader

const PouchDB = require('PouchDB');
const React = require('react');
const ReactDOM = require('react-dom');

const create_loader = require('simple-amd/lib/default-loader').create_loader;
const db = new PouchDB(YOUR_HOST);

const loader = create_loader(db, {
  react: React
});
loader.require(['attachment!docId#attachmentId', 'doc!docId'], function(attachment, observableDoc) {
  observableDoc.subscribe(data => {
    // it will render react 'reactive'
    ReactDOM.render(React.createElement(attachment.SomeModule), { data: data });
  });
});

Keywords

FAQs

Package last updated on 02 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc