小编Cha*_*hai的帖子

es2015重新导出模块并覆盖重新导出模块的单个导出功能

我想重新导出整个模块并仅覆盖重新导出模块的特定功能.但是,当已经重新报告相同的函数时,似乎不会处理导出覆盖函数.

(http://www.ecma-international.org/ecma-262/6.0/#sec-module-semantics-static-semantics-early-errors,'如果ModuleItemList的ExportedNames包含任何重复条目,则为语法错误. ")

如果我只想覆盖重新导出模块中的特定函数或方法,那么我的方法背后的动机是最小化显式重新导出非常大或长的模块.

有没有办法在es6/es2015中实现我的方法?

我的代码到目前为止:

模块a.js

export class MyFirstStandardClass {
  sendMeMessages() {
  return `hello, I'm a standard implementation`;
  }
}
export function talkToMe() {
  return `standard talking: how are you doing?`;
}
Run Code Online (Sandbox Code Playgroud)

模块b.js

import * as StandardModule from 'module-a';

export function talkToMe(condition = true) {
  if (condition) {
    return `project conditional talking: ${StandardModule.talkToMe()}`;
  }
  return `project without a condition!`;
}

export * from 'module-a';
Run Code Online (Sandbox Code Playgroud)

模块c.js

import * as MyModule from 'module-b';
import React, { Component } from …
Run Code Online (Sandbox Code Playgroud)

javascript import export ecmascript-6 reactjs

6
推荐指数
2
解决办法
2986
查看次数

Silverlight 4.0:使用WebClient UploadStringAsync POST请求到.Net 4 Webservice

我正在尝试运行此代码:

Silverlight App xaml.cs:

private void SavePoiRequest(MyPushpin pin)
    {
        WebClient wc = new WebClient();
        wc.Headers["Content-Type"] = "application/x-www-form-urlencoded";
        wc.Encoding = Encoding.UTF8;
        wc.UploadStringCompleted += new UploadStringCompletedEventHandler((sender, e) =>
        {
            if (e.Error != null)
            {
                return;
            }
            AddressTextBox.Text = e.Result;
        });
        String name = pin.Name;
        String lat  = pin.Location.Latitude.ToString().Replace(",",".");
        String lng  = pin.Location.Longitude.ToString().Replace(",",".");
        String address = pin.Address;
        String photodesc = pin.PhotoDesc;
        String poistory = pin.Tag.ToString();
        StringBuilder sr = new StringBuilder();
        sr.Append("createpoi?name="+name+ "&lat=" + lat + "&lng=" + lng + "&adr=" + address     + …
Run Code Online (Sandbox Code Playgroud)

c# silverlight web-services http-post .net-4.0

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