amd

Bootstrapping a Backbone application

。_饼干妹妹 提交于 2019-12-22 06:42:54
问题 I have seen a couple of ways on how to do this, but I can never figure out which is the 'correct' way. Jeffrey Way from NetTuts+ and Addy Osmani instantiate a 'main' application view in order to kick off their applications. require(['views/app'], function(AppView) { new AppView(); }); Ryan Bates from Railscasts starts his application by instantiating a router which then handles subsequent requests: window.App = Models: {} Collections: {} Views: {} Routers: {} init: -> new App.Router()

How can I specify library dependencies using SystemJS?

旧巷老猫 提交于 2019-12-22 05:28:16
问题 Using SystemJS, how do I specify that one library depends on another? For example, the Bootstrap JavaScript library depends on jQuery. Based on the SytemJS docs, I assumed I would specify this dependency using System.config.meta property: System.config({ baseUrl: './scripts', defaultJSExtensions: true, map: { jquery: './lib/jquery-2.2.0.min.js', bootstrap: './lib/bootstrap.min.js' }, meta: { bootstrap: { deps: ['jquery'] } } }); System.import('./scripts/app.js'); But this seems to have no

How to load custom AMD modules when using Dojo via CDN?

一世执手 提交于 2019-12-22 04:04:30
问题 I am using google's CDN and also trying to load my own AMD modules using their loader. I know I'm doing something wrong but I'm stuck. Any ideas? <script src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.js" type="text/javascript" data-dojo-config="async:true,parseOnLoad:true"></script> <script type="text/javascript"> require(["dojo/_base/kernel", "dojo/_base/loader", "dojo/parser"], function(dojo){ dojo.registerModulePath("pgGallery", "http://127.0.0.1:8080/js"); }); require([

Is there any guarantee that all of threads in WaveFront (OpenCL) always synchronized?

夙愿已清 提交于 2019-12-22 01:36:42
问题 As known, there are WARP (in CUDA) and WaveFront (in OpenCL): http://courses.cs.washington.edu/courses/cse471/13sp/lectures/GPUsStudents.pdf WARP in CUDA: http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#simt-architecture 4.1. SIMT Architecture ... A warp executes one common instruction at a time , so full efficiency is realized when all 32 threads of a warp agree on their execution path. If threads of a warp diverge via a data-dependent conditional branch, the warp serially

Require.js module not seeing Backbone Router.js

梦想与她 提交于 2019-12-22 01:32:57
问题 In this simple Require/Backbone app https://github.com/thisishardcoded/require-prob Why does app.js see Router but TestView.js not? Here is the first line of app.js define(['router'],function (Router) { and here is the first line of TestView.js define(['backbone','router'],function(Backbone,Router){ Check out the repo for full details, download, run and check console log if you feel so inclined Thanks! Jim More: Ok, the answer is - because of the order in which it is loaded and even if that

Global context inside UMD pattern

雨燕双飞 提交于 2019-12-21 20:31:05
问题 I am writing an agnostic logging mechanism that works inside the browser and in nodejs (e.g. console.debug is missing in nodejs). // UMD with no dependencies (function(global, factory) { if (typeof module === 'object') { module.exports = factory(); // GLOBAL IS NOT WHAT I WOULD EXPECT, YOU? global.console = factory(); } else if (typeof define === 'function' && define.amd) { define(factory); } else { global.console = factory(); } })(this, function() { function logger() {}; return logger; }); I

How to apply component bindings after ko.applyBindings() call

北城余情 提交于 2019-12-21 06:22:51
问题 Is there a way to apply component bindings after the ko.applyBindings() call? The point is, I use requireJS to load my modules/components async. So how do I know that all bindings are registered? Demo JS Fiddle ko.applyBindings(); ko.components.register('my-component', { viewModel: function() { this.name = ko.observable('My Name'); }, template: '<input type="text" data-bind="value: name"></input>' } ); // Moving it here, it works: // ko.applyBindings(); 回答1: There are a couple of pieces that

Can system.js replace require.js

做~自己de王妃 提交于 2019-12-21 03:42:55
问题 I'm using requirejs in a large project. This project will soon be upgraded to angular2. Angular2 uses system.js, so I'm thinking of switching to system.js too. Should I be able to remove the reference to the requirejs library and include system.js instead and expect it to work, or is there something I don't understand here? I tried by just removing the require.js file and adding the system.js file instead, but I get error messages saying define is not defined. Can you help? Will I need

Using requirejs optimizer node module with Gulp

£可爱£侵袭症+ 提交于 2019-12-20 14:43:40
问题 There's gulp-requirejs plugin, but it's blacklisted with the following message: "use the require.js module directly". The docs are quite sparse, how would I best use it in conjunction with Gulp build task? In the docs there's an example: var requirejs = require('requirejs'); var config = { baseUrl: '../appDir/scripts', name: 'main', out: '../build/main-built.js' }; requirejs.optimize(config, function (buildResponse) { //buildResponse is just a text output of the modules //included. Load the

Webpack with requirejs/AMD

假如想象 提交于 2019-12-20 12:38:40
问题 I'm working on a new module for an existing project that still uses requireJS for module loading. I'm trying to use new technologies for my new module like webpack (which allows me to use es6 loaders using es6 imports). It seems like webpack can't reconcile with requireJS syntax. It will say things like: "Module not found: Error: Can't resolve in ". Problem : Webpack won't bundle files with requireJS/AMD syntax in them. Question : Is there any way to make webpack play nice with requireJS? My