requirejs

Backbone.RelationalModel using requireJs

妖精的绣舞 提交于 2019-12-08 11:52:07
问题 I would like to use RelationalModel using requireJs. Here my code(*) When I run my module, I get the following warning message: Relation=d; no model, key or relatedModel (function (){a.apply(this,arguments)}, "tasks", undefined). My questions are: 1) what does the warning message means? 2) relatedModel and collectionType are well defined in my relations or should I export the model and the collection in define call? (*) define([ 'backbone', 'relationalModel' ], function (Backbone) { "use

Require.js loosing url context

爱⌒轻易说出口 提交于 2019-12-08 11:33:36
问题 Using this url: "localhost/app2/app.html" I would expect require.js to manipulate the paths so that all scripts it loads are prefixed with the context 'app2/'. However, I get a 404 for my app script, and when I look in firebug the browser is trying to retrieve it without the app2 context. My file structure is: content |-app.html |-main.js |-app |-app.js |-main.js |-libs |-require.js In app.html I have a single script tag: <script src="libs/require.js" data-main="app/main" type="text

Jupyter input cell with required javascript file are evaluated at page load

廉价感情. 提交于 2019-12-08 11:22:44
问题 I'am using the jupyter notebook to develop a front-end web for data visualization. Doing so, b/c i'd like to develop data-analysis procedures in python and be able to push them on the web using a minimum number of tools. As a first step, i basically followed this post and was able to develop my visualization in the notebook. Now, I would like to put the javascript code i wrote for plot rendering (mostly D3) in the input cells of jupyter in a separate js file ("customPlot.js") and be able to

Backbone general router vs. separate routing files?

百般思念 提交于 2019-12-08 11:13:07
问题 I found that most tutorials use one big router. For example: https://github.com/thomasdavis/backboneboilerplate/blob/gh-pages/js/router.js Wouldn't it be better to separate the routes (controllers) into separate files? If yes how can I combine this with requirejs? 回答1: I think this is a question of preference. If you're doing a ginormous application with gazillion routes, then dividing your routers up is sensible. For small applications having just one big router is just fine. If you decide

Initialize VideoJS from dummy element using Require.js

心不动则不痛 提交于 2019-12-08 09:39:12
问题 First of all, I explain my requirements: I have a dummy element to fire a video -> <div id="dummyElement"></div> When the user clicks/taps the dummy element, a VideoJS must to be initialized and then have to play the media on most platforms. Well, my problem is to approach this on IOS when I use Require.js library. This issue force the user to do two annoying clicks/taps to view the video. I have made some examples from a simple example to a example with requirejs and jquery promises. 1- http

Module name has not been loaded yet for context

◇◆丶佛笑我妖孽 提交于 2019-12-08 09:33:43
问题 The error is : Uncaught Error: Module name "aylien_textapi" has not been loaded yet for context: _. Use require([]) and my code is: window.addEventListener('button', summarizeNow()); function summarizeNow() { var AYLIENTextAPI = require('aylien_textapi'); var textapi = new AYLIENTextAPI({ application_id: "12049eaa", application_key: "0050eee15d54ac3dbd69d868fc1e8570" }); var current = window.location.href var sum = document.getElementById("summary"); textapi.summarize({ url: 'current',

How to call function from another file with requireJS

两盒软妹~` 提交于 2019-12-08 09:07:05
问题 I have two files - main, and events. I'm trying to call some function from one file to another. So, this is how it looks: events require(['app/main'], function(call) { // click event respond test document.body.addEventListener("click", function(e) { var target = e.target; if (target.hasClass === "call"){ functionCall()(); } }); }); main define(["jquery"], function() { // Call var box = $('.box'); return function functionCall(){ box.addClass('visible'); } }); What is wrong, can anyboyd help?

loading multiple modules using requireJS in latest firefox 21.0 fails

你说的曾经没有我的故事 提交于 2019-12-08 08:42:27
I tried with 3 diff modules as defined below credit.js define(function(){ return{ getCredits: function (){ console.log("Inside getCredits"); return 10; } } }); product.js define(function(){ console.log("Inside product"); return { bookTheProduct: function(){ console.log("Inside bookTheProduct"); return true; } } }); pruchase.js require.config({ shim: { purchase: { deps : ["credit","product"] } } }); define(["credit","product"], function(credit,product){ console.log("purchaseproduct"); return { purchaseProduct: function (){ console.log("Inside of PurchaseProduct"); var credits = credit

loading multiple modules using requireJS in latest firefox 21.0 fails

丶灬走出姿态 提交于 2019-12-08 08:32:35
问题 I tried with 3 diff modules as defined below credit.js define(function(){ return{ getCredits: function (){ console.log("Inside getCredits"); return 10; } } }); product.js define(function(){ console.log("Inside product"); return { bookTheProduct: function(){ console.log("Inside bookTheProduct"); return true; } } }); pruchase.js require.config({ shim: { purchase: { deps : ["credit","product"] } } }); define(["credit","product"], function(credit,product){ console.log("purchaseproduct"); return {

gapi is not defined error comes when using with requirejs

喜你入骨 提交于 2019-12-08 08:24:18
问题 I am trying to load google API files with requireJS, but getting an error of, One think I can understated that GP file is loading before the google's call "gp.js:23 Uncaught ReferenceError: gapi is not defined" here is the code for gp.js file function logout() { gapi.auth.signOut(); location.reload(); } function login() { var myParams = { 'clientid' : '900278902057-ppqm358qrhki089danipqguj3i4ir70i.apps.googleusercontent.com', 'cookiepolicy' : 'single_host_origin', 'callback' : 'loginCallback'