requirejs

Load Stripe.js with Require.js

一笑奈何 提交于 2021-02-10 18:00:15
问题 I'm having trouble loading Stripe.js with Require.js. My setup looks a bit like this requirejs.config({ paths: { 'stripe': 'https://js.stripe.com/v3/?noext' }, shim: { 'stripe': { exports: 'stripe' } } }); This actually does work, that is, I can see the script tag in the dom but when I require it it's undefined . Any ideas what could be happening here? 回答1: The global that stripe exports is Stripe with an uppercase "S". The exports needs to match the global export exactly , meaning case. This

「前端工程化」该怎么理解?

自作多情 提交于 2021-02-09 13:40:10
关注「 前端向后 」微信公众号,你将收获一系列「用 心 原创」的高质量技术文章,主题包括但不限于前端、Node.js以及服务端技术 一.什么是前端工程? 一个类似的术语是软件工程(Software Engineering): Software engineering is the systematic application of engineering approaches to the development of software. 将工程方法系统化地应用到软件开发中,就叫软件工程 。那么,紧接着又有两个问题: 工程方法是什么? 系统化怎么理解? 工程是指使用科学原理设计和制造机器、结构等,比如修桥、铺路、建隧道、造车、盖房子: Engineering is the use of scientific principles to design and build machines, structures, and other items, including bridges, tunnels, roads, vehicles, and buildings. 具体到软件领域,指的是 以系统、严谨、可量化的方法开发、运营、维护软件 ,软件工程包括对这些方法的应用和研究: Software engineering the application of a systematic,

How can I load external static Javascript files in ipython or jupyter notebook

一个人想着一个人 提交于 2021-02-07 09:33:07
问题 I am trying to load d3 and dimple.js in ipython notebook but its throwing error. I have tried require as well but not able to load please provide me some way out of it 回答1: Run this in the notebook to find out your jupyter directory: from jupyter_core.paths import jupyter_config_dir jupyter_dir = jupyter_config_dir() jupyter_dir Create folder named 'custom' under jupyter directory found from above /custom Create custom.js file under /custom/custom.js and add following requirejs.config({ paths

How can I load external static Javascript files in ipython or jupyter notebook

≡放荡痞女 提交于 2021-02-07 09:32:58
问题 I am trying to load d3 and dimple.js in ipython notebook but its throwing error. I have tried require as well but not able to load please provide me some way out of it 回答1: Run this in the notebook to find out your jupyter directory: from jupyter_core.paths import jupyter_config_dir jupyter_dir = jupyter_config_dir() jupyter_dir Create folder named 'custom' under jupyter directory found from above /custom Create custom.js file under /custom/custom.js and add following requirejs.config({ paths

PhantomJS require() a relative path

别说谁变了你拦得住时间么 提交于 2021-02-06 00:52:32
问题 In a PhantomJS script I would like to load a custom module but it seems relative paths do not works in PhantomJS ? script.js: var foo = require('./script/lib/foo.js'); foo.bar('hello world'); phantom.exit(); foo.js: exports.bar = function(text){ console.log(text); } According to fs.workingDirectory I am in the good directory foo.js is not in the lookup path of phantomjs Am I missing something ? EDIT: inject() is not revelant because I do not need to inject a JS to an HTML page but instead

PhantomJS require() a relative path

感情迁移 提交于 2021-02-06 00:51:41
问题 In a PhantomJS script I would like to load a custom module but it seems relative paths do not works in PhantomJS ? script.js: var foo = require('./script/lib/foo.js'); foo.bar('hello world'); phantom.exit(); foo.js: exports.bar = function(text){ console.log(text); } According to fs.workingDirectory I am in the good directory foo.js is not in the lookup path of phantomjs Am I missing something ? EDIT: inject() is not revelant because I do not need to inject a JS to an HTML page but instead

50道JavaScript基础面试题(附答案)

こ雲淡風輕ζ 提交于 2021-01-31 04:58:25
△ 是 新朋友 吗?记得先点 web前端学习圈 关注我哦~ 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 所谓异步,就是向服务器发送请求的时候,我们不必等待结果,而是可以同时做其他的事情

RequireJS paths not work

ⅰ亾dé卋堺 提交于 2021-01-29 10:48:15
问题 I'm new to RequireJS and trying to use it. I followed an example in RequireJS docs but there is some problem. I can load the jquery but not app/shell . Root |__index.html |__javascripts |__main.js |__libs | |__jquery.js | |__require.js |__app |__shell.js index.html <!DOCTYPE html> <html> <head> <title></title> <script data-main="javascripts/main.js" src="javascripts/libs/require.js"></script> </head> <body> </body> </html> main.js requirejs.config({ baseUrl:'javascripts/libs', paths:{ app:'..

does dropzone-amd-module.js support IE 11?

蹲街弑〆低调 提交于 2021-01-29 07:12:01
问题 Per the dropzone site version 5.0 should support IE10+. I am using dropzone-amd-module.js ver 5.5 in a Durandal app and IE11 does not seem to support Symbol.iterator . Since I need to support IE11 at least for a little while I'm looking for options. Does any know what the latest version of dropzone-amd-module.js is that will run in IE11? 回答1: The fix was to remove any reference to Symbol.iterator wherever it occurs (a few dozen places) from dropzone-amd-module.js like this: replace this for

Running Q on page with Require.js

可紊 提交于 2021-01-29 05:17:41
问题 I am trying to run a widget on a web page that leverages the Q library . Unfortunately, the page also uses the AddThis widget which embeds require.js and is causing a conflict. Specifically, when run together the two following error messages are displayed in the console: Uncaught ReferenceError: Q is not defined Uncaught Error: Mismatched anonymous define() module Unfortunately, I don't have control over the use of the AddThis widget. However, I do have control over the embedded application