frp

How can I subscribe to the completion of a command's execution signals without a nested subscription?

喜你入骨 提交于 2019-11-29 03:57:32
问题 I tried the following without success. The equivalent using -subscribeNext: works as expected. // A [[_viewModel.loginCommand.executionSignals flatten] subscribeCompleted:^{ NSLog(@"A"); }]; My only working implementation is as follows: // B [_viewModel.loginCommand.executionSignals subscribeNext:^(RACSignal *loginSignal) { [loginSignal subscribeCompleted:^{ NSLog(@"B"); }]; }]; Why doesn't -flatten work in "A", and how I can I rewrite "B" to not use a nested subscription? 回答1: The -flatten

Rxjs observing object updates and changes

吃可爱长大的小学妹 提交于 2019-11-29 03:57:11
I am currently trying to observe any changes to a given object including all of it's elements. The following code only fires when an object[x] is updates, but not if individually updating object[x]'s elements such as object[x][y] <script> var elem = document.getElementById("test1"); var log = function(x) { elem.innerHTML += x + "<br/><br/><br/>"; }; var a = [{a:1,b:2}, {a:2,b:5} ]; var source = Rx.Observable .ofObjectChanges(a) .map(function(x) { return JSON.stringify(x); }); var subscription = source.subscribe( function (x) {log(x);}, function (err) {log(err);}, function () {log('Completed');

Simpler alternative libs to Reactive? (Haskell)

ε祈祈猫儿з 提交于 2019-11-29 01:42:22
问题 I'm learning Haskell, and trying to write some event-driven programs. The following code is from the tutorial: http://www.haskell.org/haskellwiki/OpenGLTutorial2 main = do (progname,_) <- getArgsAndInitialize initialDisplayMode $= [DoubleBuffered] createWindow "Hello World" reshapeCallback $= Just reshape angle <- newIORef (0.0::GLfloat) -- 1 delta <- newIORef (0.1::GLfloat) -- 2 position <- newIORef (0.0::GLfloat, 0.0) -- 3 keyboardMouseCallback $= Just (keyboardMouse delta position)

How to manage state without using Subject or imperative manipulation in a simple RxJS example?

北城以北 提交于 2019-11-29 00:40:44
问题 I have been experimenting with RxJS for two weeks now, and although I love it in principle I just cannot seem to find and implement the correct pattern for managing state. All articles and questions appear to agree: Subject should be avoided where possible in favor of just pushing state through via transformations; .getValue() should be deprecated entirely; and .do should perhaps be avoided except for DOM manipulation? The problem with all such suggestions is that none of the literature

Chaining promises with RxJS

北城余情 提交于 2019-11-28 23:29:18
I'm new to RxJS and FRP in general. I had the idea of converting an existing promise chain in my ExpressJS application to be an observable for practice. I am aware that this probably isn't the best example but maybe someone can help shed some light. What I'm trying to do : I have two promises - prom1 and prom2 I want prom1 to run before prom2 If prom1 sends a reject(err), I want to cancel prom2 before it starts. I want the error message prom1 returns to be available to the onError method on the observer. var prom1 = new Promise(function(resolve, reject) { if (true) { reject('reason'); }

How do I get the current time in Elm 0.17/0.18?

谁说我不能喝 提交于 2019-11-28 21:27:57
I had asked this question already: How do I get the current time in Elm? And answered it by writing my own ( now deprecated ) variant of start-app: http://package.elm-lang.org/packages/z5h/time-app/1.0.1 Of course the Elm architecture has since changed, and my old way of doing things no longer works, because there are no signals or Time.timestamp . So.... Suppose I build an app with the standard update function signature: update : Msg -> Model -> (Model, Cmd Msg) I'd like to timestamp my model with the time at update. One unacceptable almost-solution is to subscribe to Time.every .

[笔记] 使用frp从外网访问内网

回眸只為那壹抹淺笑 提交于 2019-11-28 20:45:41
之前尝试过 otunnel ,也记录过使用方法,见 [笔记] 使用otunnel从外网访问内网 ,但是用了几天发现还是不够稳定。 然后尝试 frp ,发现性能稳定,够用,将过程及配置分享在这里吧。 需求 内网机器没有公网IP,但是可以访问外网,现在需要从外网访问内网机器。 举例,在家里机器A访问公司内网机器B。 前提 需要一台有公网IP的服务器S做中转,这样就可以打通AB两端了。 A <---> S <---> B 环境 家中A机,Win10 服务器S,Ubuntu 16.04 LTS 64 bit,公网IP: 123.12.23.13 (举例而已),SSH 端口: 22 内网B机,Ubuntu 18.04 LTS 64 bit,内网IP: 192.168.2.3 (举例而已),SSH 端口: 1122,用户名: shit 工具 大牛fatedier开发的 frp ,官网介绍如下:“frp 是一个可用于内网穿透的高性能的反向代理应用,支持 tcp, udp 协议,为 http 和 https 应用协议提供了额外的能力,且尝试性支持了点对点穿透。” 下载链接: frp ,支持Mac,FreeBSD,Linux,OpenBSD,Windows等平台,当前最新版本是 v0.28.2 教程 frp架构如下,在服务器上运行frps,在客户机上运行frpc。 官方教程: frp用法

FRP - Event streams and Signals - what is lost in using just signals?

女生的网名这么多〃 提交于 2019-11-28 19:03:17
问题 In recent implementations of Classic FRP, for instance reactive-banana, there are event streams and signals, which are step functions (reactive-banana calls them behaviours but they are nevertheless step functions). I've noticed that Elm only uses signals, and doesn't differentiate between signals and event streams. Also, reactive-banana allows to go from event streams to signals (edited: and it's sort of possible to act on behaviours using reactimate' although it not considered good practice

树莓派 frp 内网穿透

杀马特。学长 韩版系。学妹 提交于 2019-11-28 17:39:40
目标: 因为家里没有公网IP,不能像访问云服务器一样访问家里的树莓派,所以目标是外网用SSH、VNC访问家里局域网中的树莓派。 工作原理的个人理解: 在云主机上运行frp服务器,在树莓派上运行frp客户端,使他们连接起来,通过访问云主机暴露出来IP:PORT来访问云主机,再由云主机转发到它连接的树莓派。 材料: 1. 一台有公网IP的云主机 2. 一个树莓派 https://github.com/fatedier/frp/releases 在上面网站根据自己的机器下载对应版本的frp 云主机的: frp_0.17.0_linux_amd64.tar.gz 树莓派的(注意是arm): frp_0.17.0_linux_arm.tar.gz frp包内容: 其中frpc...的三个文件是frp客户端,frps...的三个文件是frp服务器端。 配置: 云主机: 在云主机上配置frps.ini [common] bind_port = 7000 # 不变 dashboard_port = 8030 # 需要是云主机开放的端口,用于进入frp后台的 dashboard_user = frp-gao # 进入frp后台的用户名 dashboard_pwd = 1998 # 进入frp后台的密码 privilege_token = 1998 # 这个需要和frpc中的token保持一致 启动: