requirejs

No method 'get' on backbone model save

主宰稳场 提交于 2019-12-08 01:48:36
问题 I'm using backbone for a reasonably complicated form. I have a number of nested models, and have been computing other variables in the parent model like so: // INSIDE PARENT MODEL computedValue: function () { var value = this.get('childModel').get('childModelProperty'); return value; } This seems to work fine for keeping my UI in sync, but as soon as I call .save() on the parent model, I get: Uncaught TypeError: Object #<Object> has no method 'get' It seems that the child model kind of

requirejs - what export exactly do here?

旧巷老猫 提交于 2019-12-08 01:46:29
问题 I use the require.js - when i use the requiredjs, i am not get the underscore and backbone while i console without using shim's export modoule. But jquery not asking this export shim dependent.. so, why we need to use the shim and it's export for the underscore and backbone? here is my code: requirejs.config({ baseUrl: 'js', paths: { "jquery":'lib/jquery-1.9.1.min', "underscore":"lib/underscore-min", "backbone" : "lib/backbone-min" }, shim:{ "underscore":{ exports: '_' //what is does here?

Configuring RequireJS to load from multiple CDNs

馋奶兔 提交于 2019-12-08 01:18:05
问题 I'm using RequireJS on our site and before the files are deployed to production we are using rjs to minify the files. Currently I am creating several minified files, not a single file. For better load times on our site we are also using multiple CDNs so the browser will open more download streams and the static content will load as fast as possible. Here lies my problem. I can configure RequireJS through the baseUrl parameter to load my scripts from our CDN, but is there a way to configure

load blue-imp jquery fileupload with RequireJS

冷暖自知 提交于 2019-12-08 01:16:32
问题 I'm trying to load the jquery fileupload by blue-imp with RequireJS. I'm facing some problem while loading it. I tried the solutions like this and this but none worked with my situation. what i did in my main.js is require.config({ baseUrl : 'js', paths: { jquery: 'lib/jquery/jquery-1.11.0', jqueryfileupload : 'lib/jquery/jquery.fileupload', underscore: 'lib/backbone/underscore/underscore-min', backbone: 'lib/backbone/backbone-min', }, shim : { 'underscore' : { exports : "_" }, 'backbone' : {

jQuery File Upload doesn't work in IE9 when compressed with Requirejs

喜欢而已 提交于 2019-12-08 00:57:42
问题 My code uses Backbone with Requirejs and jQuery File Upload and works perfectly in IE 9 when I access the development code directly (without building). As soon as I build it something goes wrong and the request is sent empty to the server. The only difference I see in the request (using Network capturing in IE9) is that the one that works when I click in the upload button, the Initiator is click , and for the one that fails, the initiator is JS Library XMLHttpRequest . So there must be

Stop global jquery with plugin in requirejs

烈酒焚心 提交于 2019-12-07 23:12:16
问题 I have jquery and jquery-cookie working together correctly below. I would like to make is so that jquery isn't global. Right now it is. Any method i've tried seems to break jquery-cookie . require.config({ paths: { "jquery": '../components/jquery/jquery', "jquery-cookie": "../components/jquery-cookie/jquery.cookie", }, shim: { "jquery-cookie": { deps: ['jquery'] } } }); require(["jquery", "jquery-cookie"], function($) { console.log($().jquery); // 1.7.2 console.log($.cookie("hello")); // null

RequireJS optimization into multiple modules

♀尐吖头ヾ 提交于 2019-12-07 22:58:32
问题 I am trying to use RequireJS to modularize our JS into a few larger JS files so that dependencies can be loaded on-demand but without the heft of a large single-JS download when loading the page. As an example, with the JS files as: js/main.js js/views/category1/js1.js js/views/category1/js2.js js/views/category2/js1.js js/views/category2/js2.js Some parts of the application (e.g. everything in category1) are only used by certain types of users, and similarly with category2, so it doesn't

Cannot load external module when trying to import i18next in TypeScript

雨燕双飞 提交于 2019-12-07 20:25:37
问题 One reason why I can't import i18next is because the i18next.d.ts file does not have declare module "i18next" { export = i18next; } at the end, like jquery.d.ts and knockout.d.ts have. It only has declare var i18next: I18nextStatic; So when I tried to import in my TypeScript file using import i18next = require('i18next'); it will barf: Cannot load external module Module cannot be aliased to a non-module type I don't know why Definitely Typed project compose the d.ts file in that way. And I

Issue getting TypeScript, Karma, RequireJS and Chai to work together

☆樱花仙子☆ 提交于 2019-12-07 19:31:34
问题 I'm trying to rewrite one of my projects using TypeScript and because I'm quite new to TypeScript and RequireJS I'm not sure what I'm missing. I've followed this guide Karma - RequireJS and double checked everything, yet I haven't managed to get it working at least not RequireJS. P.S. The error I'm getting is at the end of the post. The directory structure I'm using for this project is as follow: . |-- WebEssentials-Settings.json |-- build |-- jake.sh |-- jakefile.js |-- node_modules | |--

How to use webjars! loader plugin?

只愿长相守 提交于 2019-12-07 18:42:01
问题 In my previous Play app, I used to use Webjars & RequireJS to manage dependencies. I could use require(['angular', 'webjars!ui-bootstrap-tpls.js'], function(angular) {...}) without problem. Recently I updated webjars and several webjars related deps (webjars-ui-bootstrap, etc.) to the latest version on www.webjars.org, and I found webjars! loader plugin not working properly. I checked out the webjars-seed-play app and modified some code like: require(['angular', './controllers', './directives