requirejs

backbone.localStorage, require.js, “Uncaught TypeError: undefined is not a function”

邮差的信 提交于 2019-12-19 10:32:31
问题 I'm following Uzi Kilon's BackboneJS / RequireJS / backbone.LocalStorage example at http://kilon.org/blog/2012/08/build-backbone-apps-using-requirejs/. When I git clone https://github.com/uzikilon/Todos it works just fine - but it uses older versions of backbone.localstorage. If I replace lib/backbone.localStorage with the newer version http://cdnjs.cloudflare.com/ajax/libs/backbone-localstorage.js/1.1.0/backbone.localStorage-min , though, then I get "Uncaught TypeError: undefined is not a

what's mean “!” in require.js

落爺英雄遲暮 提交于 2019-12-19 10:28:29
问题 What's mean "!" in require.js when I included module ? What's syntax ? I what includ dinamic stylesheet in my project and I found https://github.com/martinsb/require-css plugin It's works fine . require(['css!css/sample.css'], function() { alert('Stylesheet has been loaded'); }); Why ['css!css/sample.css'] include css.js and css/sample.css ? Edit: I know alternative : define(["controller", "RequireCSS","marionette"], function (Controller, css, Marionette) { css.load("default.css"); RequireCSS

Backbone project organization

谁说我不能喝 提交于 2019-12-19 10:15:33
问题 I'm struggling a bit with coming up with a clean, solid way to organize my Backbone application. I'm using Requirejs, Handlebars, and the Requirejs Text plugin to dynamically load HTML views. To simplify things, let's just say the site has the following pages: Home: displays a collection of products About: static page Account: contains account information. products purchased, allows for various updates. Lots of functionality. Has tabs to navigate to different sections. So I'm going for an SPA

Where do i put my Knockout.js Extensions when using Typescript and requirejs

自闭症网瘾萝莉.ら 提交于 2019-12-19 07:24:17
问题 I am in the process of porting some javascript code to typescript and using requirejs. I have a config.ts: //file config.ts ///<reference path="../require.d.ts" /> ///<reference path="DataLayer.ts" /> require.config({ baseUrl: '/scripts/App/', paths: { 'jQuery': '/scripts/jquery-1.9.1', 'ko': '/scripts/knockout-2.2.1', 'signalR': "/scripts/jquery.signalR-1.0.1", }, shim: { jQuery: { exports: '$' }, signalR:{ deps: ["jQuery"] }, ko: { deps: ["jQuery"], exports: 'ko' } } }); // load AMD module

TypeScript compilation of RequireJS module generates line Object.defineProperty(exports, “__esModule”, { value: true }); How to get rid of it?

坚强是说给别人听的谎言 提交于 2019-12-19 06:18:07
问题 This is how my tsconfig.json file looks: { "compileOnSave": true, "compilerOptions": { "module": "amd", "noImplicitAny": false, "removeComments": false, "preserveConstEnums": true, "strictNullChecks": true, "sourceMap": false } } I have a typescript file named a.ts which is an AMD module (I'm using requirejs), which looks like: export function a() { var a = { b: 5 }; return a; } The compiled Javascript files looks like: define(["require", "exports"], function (require, exports) { "use strict"

Uncaught ReferenceError: define is not defined typescript

感情迁移 提交于 2019-12-19 05:06:09
问题 I am new to typescript, knockout and requirejs. I have created some demo using this files. Now, I want to implement some minor logic using typescript and knockoutjs. I have created 4-5 typescript files, which are imported internally. When I run the html file. I am getting the error stating. as Titled Can somebody help me on this error. What I am missing in this code. have search on google and spend quite a good time but didn't find the proper solutions. It must be related to requireJS to

requirejs blueimp fileuploader only loads min.js files and none other

柔情痞子 提交于 2019-12-19 04:44:29
问题 so I'm a noobie to requirejs and backbone, but I'm trying to load in all the dependencies for blueimp file uploader on my local machine and not load any external scripts. here is my config.js file: // Set the require.js configuration for your application. require.config({ // Initialize the application with the main application file. deps: ["main"], paths: { // JavaScript folders. libs: "../assets/js/libs", plugins: "../assets/js/plugins", vendor: "../assets/vendor", api : "../assets/js/libs

Cannot get requirejs to include Backbonejs

最后都变了- 提交于 2019-12-19 03:42:40
问题 I am trying to modularize my Backbone app through Requirejs, but I cannot seem to get Requirejs to include Backbone. Here is my main.js that gets included from the index page: require.config({ baseUrl: '/static/js/', paths: { jquery: 'libs/jquery/jquery-min', underscore: 'libs/underscore/underscore-min', backbone: 'libs/backbone/backbone-min', text: 'libs/require/text', }, }); require(['/static/js/views/app.js'], function(AppView) { var appView = new AppView; }); Here is my app.js that gets

RequireJS - jQuery plugins with multiple jQuery versions

99封情书 提交于 2019-12-19 03:22:31
问题 I am trying to wrap some legacy js code in modules so that they can be loaded with RequireJS. I have three jQuery plugins, let's call them a,b and c. Plugin a works with any version of jQuery Plugin b works with jQuery version 1.4.2 Plugin c uses a and b, and works with any version of jQuery. So anytime the plugin a is required, the jQuery that needs to be loaded is version 1.4.2. My require.config looks something like: require.config({ paths:{ "jquery": "libs/jquery.1.9.1.min", "jquery1-4-2"

RequireJS - jQuery plugins with multiple jQuery versions

送分小仙女□ 提交于 2019-12-19 03:22:26
问题 I am trying to wrap some legacy js code in modules so that they can be loaded with RequireJS. I have three jQuery plugins, let's call them a,b and c. Plugin a works with any version of jQuery Plugin b works with jQuery version 1.4.2 Plugin c uses a and b, and works with any version of jQuery. So anytime the plugin a is required, the jQuery that needs to be loaded is version 1.4.2. My require.config looks something like: require.config({ paths:{ "jquery": "libs/jquery.1.9.1.min", "jquery1-4-2"