requirejs

Cannot read property 'View' of undefined

ε祈祈猫儿з 提交于 2020-01-01 04:52:13
问题 This is my first time to use require.js with backbone, and I'm struggling to find the problem with my view: Cannot read property 'View' of undefined // search.js:8 My directory structure is: . ├── index.php └── js ├── app.js ├── lib │ ├── backbone.js │ ├── backbone-min.js │ ├── jquery-min.js │ ├── require.js │ └── underscore-min.js ├── main.js ├── model ├── router.js ├── text.js └── view ├── error.js └── search.js My main.js : require.config({ paths: { jquery: 'lib/jquery-min', underscore:

Cannot read property 'View' of undefined

本小妞迷上赌 提交于 2020-01-01 04:52:06
问题 This is my first time to use require.js with backbone, and I'm struggling to find the problem with my view: Cannot read property 'View' of undefined // search.js:8 My directory structure is: . ├── index.php └── js ├── app.js ├── lib │ ├── backbone.js │ ├── backbone-min.js │ ├── jquery-min.js │ ├── require.js │ └── underscore-min.js ├── main.js ├── model ├── router.js ├── text.js └── view ├── error.js └── search.js My main.js : require.config({ paths: { jquery: 'lib/jquery-min', underscore:

I am struggling with the requirejs optimizer and non AMD modules

半腔热情 提交于 2020-01-01 04:19:06
问题 I am struggling with the requirejs optimizer. This code will work if I just load it in the browser without optimization. If I run the optimizer I get : ENOENT, no such file or directory 'C:\Users\dev\checkout\src\main\webapp\resources\scripts\ json2.js' In module tree: main This is the code requirejs.config({ paths : { jquery : "lib/jquery", bootstrap : "lib/bootstrap", modals : "lib/modals", tablesort : "lib/tablesort", json2 : "lib/json2" }, shim : { "bootstrap" : [ "jquery" ], "modals" : [

requireJS with fileupload plugins

寵の児 提交于 2019-12-31 06:03:13
问题 In requirejs, we can set the name for js via this: requirejs.config({ paths: { 'jquery': '//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js' } }); And use it with this: requirejs(['jquery'],function ($) { //loaded and can be used here now. }); But for some plugin like fileuploads required a number of js files. Their document shows how to use it with requirejs: https://github.com/blueimp/jQuery-File-Upload/wiki/How-to-use-jQuery-File-Upload-with-RequireJS But, how can I manage to put

requireJS with fileupload plugins

守給你的承諾、 提交于 2019-12-31 06:02:07
问题 In requirejs, we can set the name for js via this: requirejs.config({ paths: { 'jquery': '//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js' } }); And use it with this: requirejs(['jquery'],function ($) { //loaded and can be used here now. }); But for some plugin like fileuploads required a number of js files. Their document shows how to use it with requirejs: https://github.com/blueimp/jQuery-File-Upload/wiki/How-to-use-jQuery-File-Upload-with-RequireJS But, how can I manage to put

Error loading firebase js with requirejs

。_饼干妹妹 提交于 2019-12-31 05:01:06
问题 I load Firebase js library with RequireJS like this: require([ 'firebase-app', 'firebase-storage' ], function (firebase) { firebase.initializeApp({...}); firebase.storage(); }); Until Firebase js release 4.12.1 everything was ok, since 4.13.0 release I get these errors on "firebase.storage()" call: TypeError: Cannot read property 'registerService' of undefined at firebase (index.esm.js:3442) at index.esm.js:3434 and Uncaught Error: Cannot instantiate firebase-storage - be sure to load

Can I set authorization headers with RequireJS?

三世轮回 提交于 2019-12-31 03:53:30
问题 We want to have 2 sets of resources for our AngularJS app (public/private) which uses RequireJS for dependency management. Basically everything on the login page would be public and once logged in, another angularjs app would be loaded (new requirejs config) that would load resources that require authentication to access. Is there a way to configure requirejs to set an authorization header when loading resources? 回答1: It depends on what you mean by "resources" and how your server is

Why `init` of shim in my require.js configuration not called?

筅森魡賤 提交于 2019-12-31 03:18:00
问题 Update : I was writing a small module to handle this csrf token problem in backbone until I got push notification of @Louis's answer. His answer is quite elegant and seems nice, but I'll leave a link to my backbone.csrf module github repo just for anyone who needs it. ==================================================================== I'm using Backbone as my frontend framework along with my Django backend. I had to configure my Backbone.sync to set CSRF request header for every single AJAX

Using RequireJS to load plotly and D3

落爺英雄遲暮 提交于 2019-12-31 02:16:08
问题 I am trying to use RequireJS to load the plotly and d3 libraries in my js code. I have tried this: require.config({ paths: { d3: '/static/scripts/plotly/dependencies/d3.v3.min', plotly: '/static/scripts/plotly/plotly.min' } }); require(['d3'], function(d3) { d3(); }); require(['plotly'], function(plotly) { plotly(); }); But this doesn't work. When my js function is called I get: Uncaught ReferenceError: plotly is not defined Uncaught ReferenceError: Plotly is not defined Uncaught

资深web前端工程师总结出一套正确的学习思路

北慕城南 提交于 2019-12-30 15:29:14
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 对于零基础的学员来说:初接触一门技术,想要去了解他,并掌握它,是不是觉得有点无从下手,不知道该学习什么?该先学哪个后学哪个? 今天一位资深web前端工程师,用他多年从事web前端工作的个人经验总结出一套正确的学习思路,分享给你们! 具体来说,前端方面的知识从重要程度来排,应该先后学这些: 第一步学习基础知识 api学习,系统地学,可以看看这个方面的书,不要只零散地看网上文章,这个书钱要舍得花。前端领域,这个方面我推荐看看《javascript高级程序设计》和《html5和css3权威指南》。 第二步学习一些编程技巧 学习一些编程上的技巧,比如面向对象,组件,api设计,推荐几本书《js设计模式》《head first设计模式》和《代码整洁之道》。 第三步学习一些框架 学习除jqury之外的一两个框架,因为jqury只是个库,算不上框架,加上jqury ui也仍然只是个库。学学两个前端框架,再学一个后端框架,加强对所谓框架的理解,回头再来做框架选型,就可以有自己的理解和态度了,而不是跟风。 第四步学习一些编程工具 然后学的是工具类的,比如预处理器,打包工具,调试工具,开发工具啥的,less,sass,coffeescript,grunt,git,vim之流,晚点学不会死,甚至不学也不见得有啥问题,这种工具类的