requirejs

推荐 48 道JavaScript基础面试题

江枫思渺然 提交于 2020-08-20 06:06:49
1、 介绍JavaScript的基本数据类型 Number、String 、Boolean 、Null、Undefined Object 是 JavaScript 中所有对象的父对象 数据封装类对象:Object、Array、Boolean、Number 和 String 其他对象:Function、Arguments、Math、Date、RegExp、Error 新类型:Symbol 2、 说说写JavaScript的基本规范? 1) 不要在同一行声明多个变量 2) 使用 ===或!==来比较true/false或者数值 3) switch必须带有default分支 4) 函数应该有返回值 5) for if else 必须使用大括号 6) 语句结束加分号 7) 命名要有意义,使用驼峰命名法 3、 jQuery使用建议 1) 尽量减少对dom元素的访问和操作 2) 尽量避免给dom元素绑定多个相同类型的事件处理函数,可以将多个相同类型事件 处理函数合并到一个处理函数,通过数据状态来处理分支 3) 尽量避免使用toggle事件 4、 Ajax使用 全称 :Asynchronous Javascript And XML 所谓异步,就是向服务器发送请求的时候,我们不必等待结果,而是可以同时做其他的事情,等到有了结果它自己会根据设定进行后续操作,与此同时,页面是不会发生整页刷新的

require.js与IDEA的配合

只谈情不闲聊 提交于 2020-08-11 02:30:10
本文主要讲述在html中使用requirejs时,如何让IDEA更加智能识别javascript的方法。 测试时的目录结构,一种典型的 thinkphp 的结构,同时,在 a.thml 中通过 requirejs 引用 了 Public/Home/View/moduleA/a.js, 后面我们的测试,都在 a.js 中进行。 路径可识别 + amd class, 对象,方法,都能完美识别 class 导出 我们在 Class1.js 中导出一个 Class,且只使用 AMD 方式导出,代码如下: define([], function () { class Class1 { static a() { } ia() { } } return Class1; }) View Code 当我用 control 按下时,Class1 能识别,且能进入 导出的符号 c1,能自动联想class静态,实例方法 对象导出 我们使用 moduleA/obj1.js 文件导出一个对象,代码如下: define([], function () { return { /* * * obj1 的 a 方法 */ a: function () { }, } }) View Code 同导出class一样,能完美自动联想 路径不可识别 + amd class导出 我们在 require.config 中配置了

require.js与IDEA的配合

Deadly 提交于 2020-08-07 21:26:53
本文主要讲述在html中使用requirejs时,如何让IDEA更加智能识别javascript的方法。 测试时的目录结构,一种典型的 thinkphp 的结构,同时,在 a.thml 中通过 requirejs 引用 了 Public/Home/View/moduleA/a.js, 后面我们的测试,都在 a.js 中进行。 路径可识别 + amd class, 对象,方法,都能完美识别 class 导出 我们在 Class1.js 中导出一个 Class,且只使用 AMD 方式导出,代码如下: define([], function () { class Class1 { static a() { } ia() { } } return Class1; }) View Code 当我用 control 按下时,Class1 能识别,且能进入 导出的符号 c1,能自动联想class静态,实例方法 对象导出 我们使用 moduleA/obj1.js 文件导出一个对象,代码如下: define([], function () { return { /* * * obj1 的 a 方法 */ a: function () { }, } }) View Code 同导出class一样,能完美自动联想 路径不可识别 + amd class导出 我们在 require.config 中配置了

TypeError: require.config is not a function

隐身守侯 提交于 2020-08-01 16:38:09
问题 I am using require.js as part of a brunch project. This code is throwing the error: ;require.config({ // require.config is not a function paths: { jquery: "lib/jquery", underscore: "lib/underscore", backbone: "lib/backbone", localstorage: "lib/backbone.localStorage" } }); Does that mean that requirejs is not getting included properly in the project? 回答1: If you get that error, it could be that: RequireJS is not loaded. This can diagnosed by opening the browser's debugger to look at network

How should a RequireJS transpilation plugin return its result?

女生的网名这么多〃 提交于 2020-05-17 07:28:05
问题 Transpilation plugins like es6!, es!, and cs! are more complicated than simple plugins like text! because they return javascript modules that have their own dependencies. Specifically, the code I've seen loads the specified file through XHR, transforms it, and then returns the result via a call like onload.fromText("define(['foo', 'bar', ..."); That works fine for small test cases but throws a "Mismatched anonymous define() module" exception when running in my actual app. It's a race

javascript的ES6学习总结(第二部分)

半城伤御伤魂 提交于 2020-05-08 10:02:33
1. 数组循环 介绍数组循环之前,先回顾一下ES5数组的循环 (1)数组遍历(代替普通的for):arr.forEach(callback(val,index,arr){todo}) //val是数组的当前项,index是数组的键名(下标),arr是整个数组 let arr = ['today','tomorrow','the day after tommrrow','three days from now' ]; arr.forEach( function (val,index,arr){ console.log(val,index,arr); // today 0 (4) ["today", "tomorrow", "the day after tommrrow", "three days from now"]... }); (2)数组映射:arr.map(callback(item,index,arr){todo... 正常情况下,需要配合return,返回的是一个新数组,若没有return,相当于forEach,一般用于在有return的情况下}) //item是数组的当前项,index是数组的键名(下标),arr是整个数组 let arr = [ {title: 'aaaa',read:100,hot: true }, {title: 'bbbb',read:100

ArcGIS API for JavaScript 入门教程[1] 渊源

江枫思渺然 提交于 2020-05-03 23:48:24
->对于萌新,你可能需要了解一下这个东西是什么 ->对于已经知道要用这个东西的开发者,你可能需要了解一下它的底层机制 不针对大牛。龟速更新ing. 转载注明出处。博客园&CSDN&Bilibili:@秋意正寒 目录: https://www.cnblogs.com/onsummer/p/9080204.html 1. 是什么【萌新别跳这一步】 如果非萌新,可以跳过这一段文字。 想要知道ArcGIS API for JavaScript是什么,我大概用以下几条条目描述: 是一个WebGIS二次开发(如果不知道什么是WebGIS请用搜索引擎···)的前端开发包,使用JavaScript语言 出自美国Esri公司 是Esri的ArcGIS Runtime SDK家族中的一员 它不是纯Js写的库 能说明什么呢? 它能制作在线地理信息系统平台,能做数据分析、空间分析、数据展示等; 歪果仁写的,英文资料多,虽然中文也有一定数量的资料(博客、书籍等),但是呢,由于Esri更新贼快,一年三四更的,中文资料不一定跟得上速度; 你可能需要学很多附属的东西,这个API很庞大、很笨重,入门门槛其实不高,但是深入难,前端上,你得知道造这个API的基础——Dojo框架,而Dojo框架由于历史渊源,又来自从属AMD(异步模块定义)规范的RequireJs,要想了解AMD,又不得不去看一些前端和后端的发展史

node render-requirejs OBDX business platform for android failed to execute commands

不想你离开。 提交于 2020-04-18 06:09:27
问题 For More Information: npm -v [3.10.10] , node -v [6.11.3] After execution of: npm install, Executed node render-requirejs/render-requirejs.js mobile Execution of this command is dependency as mentioned here in oracle PDF, Oracle Android PDF Link Got following errors after require execution. (async() => {^ > SyntaxError: Unexpected token ( at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579