Atitit.js模块化
atiImport 的新特性javascript import

1.
常见的js import规范amd ,cmd ,umd1

1.1.
Require更多流行3

2.
atiImport3

2.1.
Base url的设置4

2.2.
Atiimport的使用4

2.3.
Page load事件的加载要使用window。Load事件4

3.
参考4

1. 常见的js import规范amd ,cmd ,umd

五、AMD模块的写法

require.js加载的模块,采用AMD规范。也就是说,模块必须按照AMD的规定来写。

六、加载非规范的模块

理论上,require.js加载的模块,必须是按照AMD规范、用define()函数定义的模块。但是实际上,虽然已经有一部分流行的函数库(比如jQuery)符合AMD规范,更多的库并不符合。那么,require.js是否能够加载非规范的模块呢?

回答是可以的。

作者::  ★(attilax)>>>   绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://blog.csdn.net/attilax

这样的模块在用require()加载之前,要先用require.config()方法,定义它们的一些特征。

举例来说,underscore和backbone这两个库,都没有采用AMD规范编写。如果要加载它们的话,必须先定义它们的特征。

  require.config({

    shim: {



      'underscore':{

        exports: '_'

      },

      'backbone': {

        deps: ['underscore', 'jquery'],

        exports: 'Backbone'

      }

    }

  });

require.config()接受一个配置对象,这个对象除了有前面说过的paths属性之外,还有一个shim属性,专门用来配置不兼容的模块。具体来说,每个模块要定义(1)exports值(输出的变量名),表明这个模块外部调用时的名称;(2)deps数组,表明该模块的依赖性。

1.1. Require更多流行

2. atiImport

Attilax总结...麻烦的..require加载要改写原js文件格式,麻烦。

还是,使用import
机制容易的...

原理如下:::

动态insert script标签走ok兰..

// JavaScript Document

var ImportMap={};

function importx(jsSrc)

{

if(ImportMap[jsSrc])

return;

ImportMap[jsSrc]=1;

var oHead = document.getElementsByTagName('HEAD').item(0);

var oScript= document.createElement("script");

oScript.type = "text/javascript";

oScript.src=import_base+jsSrc;

oHead.appendChild( oScript);

}

2.1. Base url的设置

<script>

var apiurl="/wrmiServlet";

var import_base="../";

$ex_show_err_str=true;

</script>

<script type="text/javascript" src="../com.attilax/core/import.js"></script>

2.2. Atiimport的使用

importx("com.attilax/dataService/dataServiceV2q329.js");

importx("com.attilax/web/req.js");

importx("com.attilax/web/dslUtil.js");

importx("com.attilax/core/jqUtil.js");

importx("com.attilax/core/ex.js");

importx("com.attilax/core/core.js");

importx("com.attilax/text/str.js");

importx("com.attilax/web/urlUtil.js");

importx("com.attilax/ui/Table.js");

2.3. Page load事件的加载要使用window。Load事件

最好不个
defer   ,jq  load都加上,确保js加载完成

3. 参考

Javascript模块化编程(三):require.js的用法
- 阮一峰的网络日志.html

动态加载JS脚本的4种方法
- JavaScript - web - ITeye论坛.html

Atitit.js模块化 atiImport 的新特性javascript import的更多相关文章

  1. Atitit js版本es5 es6新特性

    Atitit js版本es5 es6新特性 Es5( es5 其实就是adobe action script的标准化)1 es6新特性1 Es5( es5 其实就是adobe action scrip ...

  2. atitit.js 各版本 and 新特性跟浏览器支持报告

    atitit.js 各版本 and 新特性跟浏览器支持报告 一个完整的JavaScript实现是由以下3个不同部分组成的 •核心(ECMAScript)--JavaScript的核心ECMAScrip ...

  3. atitit.atiOrm.js v2 q61 版本新特性.docx

    atitit.atiOrm.js v2 q61 版本新特性.docx 1. V1新特性如下1 1.1. V2规划,直接生成sql在js端1 2. Orm设计框架图1 2.1. atiOrm.js的原理 ...

  4. Atitit. WordPress 4.2.2新特性对比 attilax总结

    Atitit. WordPress 4.2.2新特性对比 attilax总结 1. WordPress 2.9带来的新特性 1 2. WordPress3.0最为突出的五个新特征 2 3. WordP ...

  5. 介绍Ext JS 4.2的新特性的《深入浅出Ext JS》上市

    以用户为中心的时代,应用的界面外观变得越来越重要.然而,很多程序员都缺乏美术功底,要开发出界面美观的应用实属不易.Ext JS的出现,为广大程序员解决了这一难题.它有丰富多彩的界面和强大的功能,是开发 ...

  6. Atitit dsl exer v3 qb3 新特性

    Atitit dsl exer v3 qb3 新特性 /atiplat_cms/src/com/attilax/dsl/DslParser.java V3 支持typeed参数,与简化的notyp参数 ...

  7. 【译】 Node.js v0.12的新特性 -- Cluster模式采用Round-Robin负载均衡

    原文:https://strongloop.com/strongblog/whats-new-in-node-js-v0-12-cluster-round-robin-load-balancing 本 ...

  8. Atitit.wrmi web rmi框架新特性

    Atitit.wrmi web rmi框架新特性 1. V1d  新特性1 1.1. 增加了精确参数1 1.2. 增加了req参数,命名参数模式..1 1.3. 增加了globale  传递隐含参数r ...

  9. Atitit..jdk java 各版本新特性 1.0 1.1 1.2 1.3 1.4 1.5(5.0) 1.6(6.0) 7.0 8.0 9.0 attilax 大总结

    Atitit..jdk java 各版本新特性 1.0 1.1 1.2 1.3 1.4 1.5(5.0) 1.6(6.0) 7.0 8.0 9.0 attilax 大总结 1.1. Java的编年史2 ...

随机推荐

  1. linux安装配置redis

    redis是支持linux的,所以linux安装redis非常简单,按照官网的提示操作即可. 下载 $ wget http://download.redis.io/releases/redis-3.2 ...

  2. 诡异的 "密码取回" 邮件问题

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...

  3. 【spring cloud】spring cloud分布式服务eureka启动时报错:java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V

    spring cloud分布式服务eureka启动时报错:java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApp ...

  4. selenium+python自动化88-批量操作循环点击报错:Element not found in the cache - perhaps the page has changed since it was looked up

    前言 selenium定位一组元素,批量操作循环点击的时候会报错:Element not found in the cache - perhaps the page has changed since ...

  5. MyBatis 显示日志

    <!-- 全局配置 --> <settings> <setting name="cacheEnabled" value="false&quo ...

  6. spring的6个不同的功能模块

    Spring自带的jar文件 Spring模块组成图 Spring的主要模块各自是核心Spring容器,spring的AOP模块,数据訪问与集成,web和远程调用,測试. 核心spring容器: 容器 ...

  7. delphi Align属性

    ---------------------------------------------- -

  8. 2017.12.25 Mybatis物理分页插件PageHelper的使用(二)

    参考来自: 官方文档的说明:https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/HowToUse.md 上篇博客 ...

  9. Linux命令之编辑

    vi是终端命令行里功能最强的文本编辑器了,但眼下须要用到的仅仅是文本编辑功能.与GCC.make等工具的整合应用如今还不须要,所以操作难度不大,习惯就好. Linux发行版所带的一般不是vi,而是vi ...

  10. vue项目中provide和inject的运用

    类型: provide:Object | () => Object inject:Array<string> | { [key: string]: string | Symbol | ...