小编eng*_*can的帖子

typescript扩展了一个不需要的接口

我有两个接口;

interface ISuccessResponse {
    Success: boolean;
    Message: string;
}
Run Code Online (Sandbox Code Playgroud)

interface IAppVersion extends ISuccessResponse {
    OSVersionStatus: number;
    LatestVersion: string;
}
Run Code Online (Sandbox Code Playgroud)

我想将ISuccessResponse接口扩展为Not Required; 我可以覆盖它,但还有其他选择吗?

interface IAppVersion {
    OSVersionStatus: number;
    LatestVersion: string;
    Success?: boolean;
    Message?: string;
}
Run Code Online (Sandbox Code Playgroud)

我不想这样做.

javascript interface typescript

18
推荐指数
3
解决办法
8350
查看次数

如何在Cordova中实施Google跟踪代码管理器

在SPA中阅读了Google跟踪代码管理器v4 - 入门并将Google跟踪代码管理器和Google Analytics集成

即使我可以,我也不确定它在Javascript方面的处理方式.所以我想在原生方面处理.但谷歌的文档有点令人困惑.我对Cordova和GTM文章一无所知.有什么想法吗?还是一步一步指导?

javascript android google-analytics cordova google-tag-manager

12
推荐指数
1
解决办法
2573
查看次数

Phonegap:在特定文件夹中创建文件

我的目标是创建一个像"/ sdcard/files/excel /"或"/ sdcard/files/pdf /"这样的文件夹.后面的部分sdcard来自url("/ files/excel").首先,我想检查"/ files/excel"是否存在,然后创建一个文件(如果它也不存在).该名称来自名为"localFileName"的url.

在这种情况下,folder ="files/excel"和localFileName ="Sheet1.html".

在fs.root.getDirectory行之后,我得到了名为FileError.PATH_EXISTS_ERR的错误12,但sdcard中没有文件夹或文件.

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fs) {
  var folder = file_path.substring(0,file_path.lastIndexOf('/'));
  console.log(folder);
  fs.root.getDirectory(folder,{create: true, exclusive: false},function (datadir) {
    console.log(folder);
    datadir.getFile(localFileName, {create: true, exclusive: false},function(fileEntry) {
      var ft = new FileTransfer();
      yol = "/sdcard/"+folder+localFileName;
      ft.download( remoteFile,yol,function(entry) {
        console.log(entry.fullPath);
      }, fail);
    }, fail);
  }, fail);
}, fail);
Run Code Online (Sandbox Code Playgroud)

directory file cordova

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

android facebook sdk v4.0无法正常工作

使用Eclipse.SDK Manager是最新的.然而,当我将facebook SDK导入我的工作区时.它会引发很多错误.

facebook-android-sdk-4.0.0\facebook\res\values\messenger_button_styles.xml:66: error: Error: No resource found that matches the given name: attr 'android:textAllCaps'. 我从值中删除了它.

The import android.support cannot be resolved我添加了支持v4 '<>' operator is not allowed for source level below 1.7如果我改变编译器它会给kitkat下面的错误.当我这样做insert inferred type arguments它消失了.然后它给出了螺栓库错误.然后我下载了螺栓并导入它.这次螺栓怎么能提供很多我无法进一步修复的东西.任何建议.

eclipse android facebook facebook-android-sdk

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

来自Cordova活动的回调

我有一个名为'Signature'的活动,我从CordovaPlugin调用它;

Plugin.java

public boolean execute(String action, JSONArray args,
            CallbackContext callbackContext) throws JSONException
    {
    Intent i = new Intent(context, Signature.class);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    cordova.startActivityForResult(this,i,90);
}
    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
        Log.d(TAG, "activity result in plugin: requestCode(" + requestCode + "), resultCode(" + resultCode + ")");
        if(requestCode == 90) {
             if (resultCode == this.cordova.getActivity().RESULT_OK) {
                 Bundle res = intent.getExtras();
                 String result = res.getString("results");
                 Log.d("FIRST", "result:"+result);
                 this.callbackContext
                 .success(result.toString());
             } else {
                 this.callbackContext.error("Error");
             }
     }
Run Code Online (Sandbox Code Playgroud)

Signature.java

private void finishWithResult(String result,int status)
{ …
Run Code Online (Sandbox Code Playgroud)

java android callback phonegap-plugins cordova

7
推荐指数
1
解决办法
3805
查看次数

如何在C#中比较字符串和字符串数组?

我有一个字符串;

String uA = "Mozilla/5.0 (iPad; CPU OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12D508 Twitter for iPhone";

String[] a= {"iphone","ipad","ipod"};
Run Code Online (Sandbox Code Playgroud)

它必须返回,ipad因为ipad在字符串的第一个匹配ipad.在其他情况下

String uA = "Mozilla/5.0 (iPhone/iPad; CPU OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12D508";
Run Code Online (Sandbox Code Playgroud)

相同的字符串数组首先匹配iPhone.

c# user-agent compare string-comparison

5
推荐指数
1
解决办法
355
查看次数

将Sublime 3 JS代码片段转换为打字稿

我在JS上有很多有用的代码片段。像clconsole.log();

fn 对于

function methodName (arguments) {
    // body...
}
Run Code Online (Sandbox Code Playgroud)

但是我不能在*.ts文件上使用它们。

如何还可以管理js到TS的代码段和组合。

谢谢

javascript code-snippets typescript sublimetext3

5
推荐指数
1
解决办法
480
查看次数