8000 New feature: $createObservableFunction by regou · Pull Request #48 · vuejs/vue-rx · GitHub
[go: up one dir, main page]

Skip to content

New feature: $createObservableFunction #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 28, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Fa 8000 iled to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
readme y version
  • Loading branch information
wx-ps committed Jul 14, 2017
commit b9f6144550c26dcc17555e38918f22d9d66e0c78
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,29 @@ var vm = new Vue({
})
```

#### `$createObservableFunction(functionName)`

> This feature requires RxJS.

Convert function calls to observable sequence which emits the call arguments.

This is a prototype method added to instances. Use it to create a shared hot observable from a function name. The function body will assigned to vm.

```html
<custom-form :onSubmit="submitHandler"></custom-form>
```
``` js
var vm = new Vue({
subscriptions () {
return {
formData: this.$createObservableFunction('submitHandler')
}
}
})
```
[example](https://github.com/vuejs/vue-rx/blob/master/example/counter-function.html)


### Caveats

You cannot use the `watch` option to watch subscriptions, because it is processed before the subscriptions are set up. But you can use `$watch` in the `created` hook instead.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-rx",
"version": "3.2.0",
"version": "3.3.0",
"description": "RxJS bindings for Vue",
"main": "dist/vue-rx.js",
"files": [
Expand Down
0