小编tro*_*ble的帖子

如何使用jsdoc 3或jsdoc记录Require.js(AMD)模块?

我有两种类型的模块:

Require.js主文件:

    require.config({
      baseUrl: "/another/path",
      paths: {
        "some": "some/v1.0"
      },
      waitSeconds: 15,
      locale: "fr-fr"
    });


    require( ["some/module", "my/module", "a.js", "b.js"],
      function(someModule,    myModule) {
      }
    );
Run Code Online (Sandbox Code Playgroud)

调解员模式:

define([], function(Mediator){

var channels = {};
if (!Mediator) Mediator = {};  

Mediator.subscribe = function (channel, subscription) {   
  if (!channels[channel]) channels[channel] = [];
   channels[channel].push(subscription);
};

Mediator.publish = function (channel) {
  if (!channels[channel]) return;
  var args = [].slice.call(arguments, 1);
  for (var i = 0, l = channels[channel].length; i < l; i++) {
    channels[channel][i].apply(this, args);
  } …
Run Code Online (Sandbox Code Playgroud)

javascript jsdoc requirejs js-amd

27
推荐指数
3
解决办法
1万
查看次数

我在哪里可以找到一些好的骨干关系教程?

我正在学习backbone.js和它周围的整个微观世界!但是我在一个插件上仍然令人惊叹:Backbone-Relational.

github上,文档太短了,不适合初学者!这就是我的感受!

有人有关于骨干关系的教程吗?我搜索谷歌但我真的没有找到朝这个方向发展的东西.

非常感谢你帮助我!

backbone.js backbone-relational

11
推荐指数
2
解决办法
4243
查看次数

如何使用Prototype获取输入值?

我有以下输入,没有任何形式:

<input type="text" value="myValue" name="td_website static" class="td_inner_input">
Run Code Online (Sandbox Code Playgroud)

如何通过原型获取Input值?我尝试使用alert($('tb_website static').value);,但它不起作用.

prototypejs

10
推荐指数
2
解决办法
3万
查看次数

如何使用Backbone.js从嵌套的JSON构建集合/模型

我是Backbone.js的新手

我有一个JSON,如图所示!我看到一些关于Backbone-relational的答案,但仍然没有明白这一点!

如何将此JSON转换为Backbone.js集合/模型?

我用代码更新,但它不像预期的那样工作!我做的时候看不到模特:

我的结构是:

[0]:是模型的集合

[clefs] + ... + [Rest]:是模型的集合

(谱号)=> [0] + ... + [9]:是模型(标题包含字符串,路径也是)

非常感谢!!

编辑(10.01.12):

我的解决方案

window.initModel = Backbone.Model.extend({
  defaults: {
    "title": "",
    "path": ""
  }
});
window.CustomCollection = Backbone.Collection.extend({
  model: initModel
});
window.Init = Backbone.Model.extend({
  url : function(){
    return  "/api/data.json"      
  },

  parse: function(response) {

    clefs = new CustomCollection();
    clefs.add(response.clefs);        
    this.set({clefs: clefs});

    .....

    rests = new CustomCollection();
    rests.add(response.rests);        
    this.set({rests: rests});
} 
});
Run Code Online (Sandbox Code Playgroud)

这也帮助了我!

嵌套数组

javascript backbone.js backbone-relational

10
推荐指数
1
解决办法
2万
查看次数

我如何/然后在"胡子" - 像underscore.js?

我使用underscore.js进行HTML模板化,设置为使用胡子语法,如下所示: {{ }}

我有这个代码:

 <% if (typeof(date) != "undefined") { %>
  <span class="date"><%= date %></span>
 <% } %>
Run Code Online (Sandbox Code Playgroud)

如何将其翻译为underscore.js胡子样式模板,使用{{ }}

mustache backbone.js underscore.js

10
推荐指数
1
解决办法
3159
查看次数

如何使用Requirejs将Web Workers用于模块构建?

我有一个用Requirejs和Backbonejs编写的应用程序很好的应用程序,但有时候它确实在减慢...例如,当它要进行一些算术工作时!我尝试使用Web Worker来完成这样的算术运算:

我的模块(traffic.js):

define(["jquery", "use!underscore", "use!backbone", "namespace" ],
  function ($, _, Backbone, globals) {
    .....  
    var worker = new Worker("arithmetic.js");
    worker.addEventListener('message', function(e) {
         console.log(e.data);
    }, false);

    worker.postMessage(globals.data); // Send data to our worker.
  });
Run Code Online (Sandbox Code Playgroud)

arithmetic.js:

define(["use!underscore", "use!backbone" ],
  function ($, _) { 
      //Here die Operations
 });
Run Code Online (Sandbox Code Playgroud)

但我有错误定义没有定义!!

我试着像这样过,但没有成功!

如何使用Web Worker进入requirejs或使用backbonejs?

谢谢!

web-worker requirejs backbone.js

9
推荐指数
1
解决办法
7275
查看次数

How can I configure the HTTP proxy for a Micronaut (1.1.4) HTTP client like the Spring Boot way?

Well after struggling a lot with Micronaut to dompted our proxies, I came to the idea to write a Spring Boot Application doing for the same purpose.

For Spring Boot the HTTP proxy configuration is really straight forward and there are a lot examples available. I came out with this example:

application.properties

generic.proxyHost = my.corporateproxy.net
generic.proxyPort = 3128
Run Code Online (Sandbox Code Playgroud)

MyController.java

@Value("${generic.proxyHost}")
private String proxyHost;

@Value("${generic.proxyPort}")
private Integer proxyPort;

@GetMapping("/proxy")
public HttpStatus getApiWithProxy(){

    SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
    InetSocketAddress address = new …
Run Code Online (Sandbox Code Playgroud)

java spring-boot micronaut

9
推荐指数
1
解决办法
214
查看次数

如何在Nativescript应用程序中创建angular 2组件?

我正在使用带有角度2的nativescript。

我想知道如何在Nativescript项目中快速创建ng组件。例如,在Angular 2中创建我们正在使用的组件ng generate component hello

是否有针对此的nativescript CLI解决方案?

nativescript angular2-nativescript angular

8
推荐指数
3
解决办法
6826
查看次数

如何使用groovy for Jenkins自动化Maven和Java JDK8安装?

我正在构建一个Jenkins Docker映像,我想自动化最后一个JDK的Maven 3和Java 8的安装。但是不幸的是,我使用这两个groovy文件定位到groovy文件夹中:

groovy / java.groovy

import jenkins.model.*
import hudson.model.*
import hudson.tools.*

def inst = Jenkins.getInstance()

def desc = inst.getDescriptor("hudson.model.JDK")

def versions = [ "jdk8": "jdk-8u202"]
def installations = [];

for (v in versions) {
  def installer = new JDKInstaller(v.value, true)
  def installerProps = new InstallSourceProperty([installer])
  def installation = new JDK(v.key, "", [installerProps])
  installations.push(installation)
}

desc.setInstallations(installations.toArray(new JDK[0]))

desc.save()
Run Code Online (Sandbox Code Playgroud)

groovy / maven.groovy

import jenkins.*;
import jenkins.model.*;
import hudson.*;
import hudson.model.*;

mavenName = "maven3"
mavenVersion = "3.6.0"
println("Checking Maven …
Run Code Online (Sandbox Code Playgroud)

java groovy maven jenkins docker

8
推荐指数
1
解决办法
393
查看次数

使用 Micronaut 获取多个请求参数 @PathVariable 和 @RequestAttribute?

我的控制器中有一个带有不同参数的 get 函数:

myinterface.java

public interface MyInterface {

   @Get(value = "/bob/{name}/params?surname={surname}")
   String getMyParam (
   @Parameter(name="name", required=true)
   @PathVariable("name") String name, 
   @NotNull 
   @Parameter(name="surname", required=true) 
   @Valid 
   @RequestAttribute(value="surname") String surname) {

   }
}
Run Code Online (Sandbox Code Playgroud)

我的控制器.java :

public class MyController implements MyInterface {

   @Override
   public String getMyParam(String name, String surname) { return name + surname; }
}
Run Code Online (Sandbox Code Playgroud)

但是当我调用“ http://localhost:8080/bob/marley/params?surname=lion ”时,它会发送一条错误消息:找不到页面。

当我使用可选参数时,/books{?max,offset}它就起作用了。我错过了什么?

执行查询请求时 PathVariable 和 RequestAttribute 是否不可混合?

编辑 1

当我?surname=={surname}从@Get 值中删除 时,它会发生“HttpClientResponseException:需要参数 [String surname] 未指定”。

micronaut

6
推荐指数
1
解决办法
5682
查看次数