ApoorvSaxena / ApoorvSaxena/lozad.js

Export as named AMD module

未关闭
#233 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
JavaScript
星标
7.5k
派生
435
PR 合并指标
30 天内没有已合并 PR

描述

## Expected Behavior
When using AMD modules, lozad should be a named AMD module, as one has to interact with it

## Current Behavior

It is an anonymous AMD function

## Possible Solution

```javascript
define('lozad',[], function() {..})
```
instead of

```javascript
define(function() {..})
```

## Steps to Reproduce (for bugs)

## Context

I need to import loadz in another module to initialize it.

Quote from jQuery:

> // Register as a named AMD module, since jQuery can be concatenated with other
> // files that may use define, but not via a proper concatenation script that
> // understands anonymous AMD modules. A named AMD is safest and most robust
> // way to register. Lowercase jquery is used because AMD module names are
> // derived from file names, and jQuery is normally delivered in a lowercase
> // file name. Do this after creating the global so that if an AMD module wants
> // to call noConflict to hide this version of jQuery, it will work.
>
> // Note that for maximum portability, libraries that are not jQuery should
> // declare themselves as anonymous modules, and avoid setting a global if an
> // AMD loader is present. jQuery is a special case. For more information, see
> // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon

## Tested on:

Applies to all AMD environments

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。