requirejs

How do I create a flag when fallback link was executed in requireJS

空扰寡人 提交于 2019-12-12 05:49:30
问题 I have this piece of code: var skin = "christmas"; requirejs.config({ paths: { languagesLocal : [ BaseUrl + skin + '/js/languagesLocal', BaseUrl + "default" + '/js/languagesLocal' ] } }); I want to have a variable that tells me which link was executed. something like isFallbackLinkWasExecuted == true How can I achieve that? or execute a code incase the fallback link was triggered. 来源: https://stackoverflow.com/questions/13974386/how-do-i-create-a-flag-when-fallback-link-was-executed-in

BreezeJS RequireJS support unstable (knockout example)

蹲街弑〆低调 提交于 2019-12-12 04:57:01
问题 As I'm trying to compile my project with breeze and requirejs for production, I'm running into multiple issues. Unrolling this, I tried starting fresh with the Knockout RequireJS example. After I installed MVS2013Pro I was able to run the project, but not without issues: window.breeze is defined so it has been leaked to global scope (this should not happen with RequireJS) Hitting F5 Refresh will crash with Uncaught Error: Can't find breeze and/or Q (breeze savequeuing) Uncaught TypeError:

Requirejs dependency not working

回眸只為那壹抹淺笑 提交于 2019-12-12 04:53:50
问题 I am trying to use angular-ladda directive in my app. Here is my main.js which is the requirejs manifesto file: requirejs.config({ paths: { underscore: 'lib/underscore/underscore', angular: 'lib/angular/angular', jquery: 'lib/jquery/dist/jquery.min', 'angular-route': 'lib/angular-route/angular-route', 'controllers': 'js/controllers', 'services': 'js/services', 'providers': 'js/providers', 'filters': 'js/filters', 'directives': 'js/directives', 'app': 'js/app', 'spin': 'lib/ladda/dist/spin.min

requirejs on a windows phone 7

点点圈 提交于 2019-12-12 04:34:00
问题 So I asked a question earlier about windows phone 7 with backbone and jquery and require. I carried on investigating this and stripped it down to the bare minimum and index page that just has <script data-main="js/main" src="js/vendor/require/requireNew.js"></script> and then a main.js that just has one path to jQuery require.config({ //path mappings for module names not found directly under baseUrl paths: { jquery: 'vendor/jqm/jquery_1.7_min' } }); alert('why'); $(document).ready(function()

Can't get Backbone-relational to work with AMD (RequireJS)

我怕爱的太早我们不能终老 提交于 2019-12-12 04:23:36
问题 I have the following Backbone router definition in CoffeeScript: // appointments_router.js.coffee define ["app", "appointment"], (App) -> class Snip.Routers.AppointmentsRouter extends Backbone.Router initialize: (options) -> @appointments = new Snip.Collections.AppointmentsCollection() @appointments.reset options.appointments Here is the "appointment" module on which it depends: // appointment.js.coffee define ["app", "relational"], (App) -> class Snip.Models.Appointment extends Backbone

requirejs and async timeout error

ε祈祈猫儿з 提交于 2019-12-12 04:18:30
问题 I've referenced the solution here but it doesn't seem to work for me no matter what I do the script just doesn't load: Load async resource with requirejs timeout This is what I have: (function () { require.config({ paths: { async: '/dist/async', } }); require(["gapiModule"], function (gapiModule) { ); })(); // gapiModule define(['async!https://apis.google.com/js/client.js!onload'], function () { console.log('google client added'); } ); No matter what I try I get a script timeout error, any

RequireJS Setting Path to the Parent Level

放肆的年华 提交于 2019-12-12 04:13:46
问题 In order to direct my models, collections, etc. from my mobile app to my web app, I need to configure my RequireJS. I have the following file structure: / /js /models /mobile /js /templates I want my mobile app to use my main app's models, so I set the following: require.config( { paths : { models : '/js/models', templates : 'mobile/templates' } }); And I get these errors in Chrome: Uncaught SyntaxError: Unexpected token < /mobile/js/models/User.js?bust=0.1.0:1 Uncaught SyntaxError:

Backbone console.log returning collection and undefined

[亡魂溺海] 提交于 2019-12-12 03:35:58
问题 Something odd is going on with my Backbone project. I'm rebuilding it as AMD and I'm having to change some variable names to get it working again. I have a collection I'm passing into a view, but when I console.log the collection, I get both the object and null. Here is my view: define([ 'jquery', 'underscore', 'backbone', 'models/tableModel', 'collections/tablesCollection', 'views/tablesView', 'views/tableView' ], function($, _, Backbone, tableModel, tablesCollection, tableView) { var tv =

Optimize RequireJS front-end application

二次信任 提交于 2019-12-12 03:34:48
问题 I am learning to use r.js to optimize/minify/uglify a front-end app. So far it is really cool and promising, but I am trying to figure out how to do one thing. I want to able to concatenate all the files (js,css,html) in a directory into one optimized file that I can put in a script tag on the front-end. So far I have only succeeded in putting only the JS files listed in my requirejs.config file into one optimized file. But I am wondering if there is a way to concatenate more files than just

RequireJS call to “module”

谁都会走 提交于 2019-12-12 03:25:43
问题 I'm working on a legacy app that I inherited that uses RequireJS and django-require to load many JavaScript modules. I'm somewhat new to RequireJS. I have a define call in one of the modules define([ "module", "lib/jquery", "./scripts/*myScriptName*", [...] ], function(module, $, myScriptName, [...]) { var pr = module.prefix; *do something with pr* return myScriptName; } "module" is a value of the literal; anything not literal starts with "my" I suspect "module" here refers to a myScriptName