小编anu*_*der的帖子

打字稿中的 window.webkit

我需要将 javascript 代码重写为 typescript (angular),网页由 IOS 应用程序或 Android 应用程序打开。我只想向应用程序发送消息。

如何向父应用程序发送消息或如何使用window.webkit

notifyTheApp(postData) {
  if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
    if(window.webkit.messageHandlers)      
     window.webkit.messageHandlers.mpos.postMessage(JSON.stringify(postData));
    } 
    else {
      if(window.external.notify)
        window.external.notify(JSON.stringify(postData));
    }

Run Code Online (Sandbox Code Playgroud)

mpos 是iOS应用

src/app/sms-validation/sms-validation.component.ts(98,17) 中的错误:错误 TS2339:“窗口”类型上不存在属性“webkit”。

javascript webkit typescript angular

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

如何在启动时捕获 flutter 应用程序崩溃

我需要捕获应用程序崩溃日志,此应用程序崩溃发生在 AndroidStudio 启动时运行/调试时(仍然没有签名的 apk)。我尝试过使用哨兵,但没有发现任何错误。

我尝试在 try-catch 上测试打印文本,main.dart但哨兵无法捕获它。

有更好的主意吗?

flutter flutter-test flutter-dependencies

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

运行新的 kafka 服务器会抛出异常,提示端口 9092 alrady 正在使用,即使我更改了 porperties 文件中的端口

server-1.properties更改了端口、日志和代理 ID,但是当我启动它时,server-1它会抛出

KafkaException:套接字服务器无法绑定到 0.0.0.0:9092:地址已在使用中。

日志中我看到其他属性已更改,但端口已更改9092

这是server-1.properties文件:

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of …
Run Code Online (Sandbox Code Playgroud)

apache-kafka

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

如何删除 Elementor 中小部件和布局子项之间的间隙/空间?

在 Elementor 中,默认情况下,如果我们在小部件内添加布局,我们可以看到小部件和布局(小部件的子级)之间存在间隙或空间,如下图所示:

在此输入图像描述

有什么办法可以删除它,因为我仍然找不到它。

html css wordpress web elementor

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

Unity3D - 如何消除按钮点击动画的延迟

我正在制作一个需要快速响应的简单游戏。所以在GUI中,会有一些按钮。如果我按下按钮 X 然后执行动画 X,那么如果我按下按钮 Y 然后执行动画 Y 。目前,我只创建一个按钮来测试。

但有一个问题。每当我单击按钮 X 时,动画播放前都会有大约 1-2 秒的延迟。

动画师方案: 在此输入图像描述

按钮单击目标:

在此输入图像描述

TalkingButtonScript.cs:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;

 public class TalkingButtonScript : MonoBehaviour {

     public Button Text;
     public AudioClip sound;
     public Animator ani;
     public Canvas yourcanvas;
     Animator myAnimator;
     public PlayerAnimatorControllerScript cas;

     void Start () 
     {
         Text = Text.GetComponent<Button> ();
         ani.enabled = true;
         yourcanvas.enabled = true;
     }

     public void Press() 
     {
         PlayerAnimatorControllerScript.instance.talking_btn_clicked = true;
     }
 }
Run Code Online (Sandbox Code Playgroud)

PlayerAnimatorControllerScript.cs :

 using System.Collections; …
Run Code Online (Sandbox Code Playgroud)

c# animation unity-game-engine

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

React Native错误:属性“历史记录”不存在

我正在使用 mongodb、express 和 React 创建注册登录模块,但在创建此模块时遇到属性历史记录不存在错误:

类型“Readonly & Readonly<{children?: ReactNode;”上不存在属性“history” }>'.ts(2339)

import React, { Component } from 'react'
import { login } from './userfunctions'

interface userprops{}
interface data{
    email:string;
    password:string;
    errors: string;
}
Run Code Online (Sandbox Code Playgroud)

//主类:

class Login extends Component<userprops, data> {
  constructor(props: userprops) {
    super(props)
    this.state = {
      email: '',
      password:'',
      errors: ''
    }
this.onChange = this.onChange.bind(this) //binding the function
this.onSubmit = this.onSubmit.bind(this)  //binding the function
  }
  onChange(e:any) {  //on change function
    this.setState({ email: e.target.value })
  }
  onSubmit(e:any) {   //on submitting the …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs react-router react-native

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

Android Volley - 没有来自StringRequest的回复

JSON使用Android Volley时我无法获得响应.没有错误也没有Succesfull响应see(Log.d("logr=",_response);).我使用StringRequest从Google Map API Android V2获取JSON文本.这是代码

private String urla = "https://maps.googleapis.com/maps/api/place/search/json?location=";
private String urlb = "&types=hotel&radius=500&sensor=false&key=YOUR_KEY";


   @Override //::LocationListener (Interface)
    public void onLocationChanged(Location location) {
        //Log.d(TAG, "Firing onLocationChanged..............................................");
        mCurrentLocation = location;
        CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()), 13);
        googleMap.animateCamera(cameraUpdate);

        double x = location.getLatitude();
        double y = location.getLongitude();

        String request = urla+x+","+y+urlb;
        Log.d("log1=",request);
        StringRequest stringRequest = new StringRequest(Request.Method.GET, request,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String _response) {

                        Log.d("logr=",_response);

                    }
                }, new Response.ErrorListener() {
            @Override …
Run Code Online (Sandbox Code Playgroud)

connection android json android-volley

0
推荐指数
1
解决办法
5006
查看次数