-2
我nede如果我按下代码执行每5秒 在其他语言我使用endlis循环 和我把里面的睡眠功能 这是我的代码我nede如果我按代码按每5秒执行
_onPress() {
var ws = new WebSocket('ws://myhost.org:800');
ws.onopen =() => {
// connection opened
ws.send("hi)
ws.close();
};
}
render() {
return (
<View style={styles.container}>
<Button
onPress={this._onPress.bind(this)}
title="open"
color="#841584"
accessibilityLabel="Learn more about this purple button"
/>
</View>
);
}