Last active
October 22, 2017 18:33
-
-
Save rarmatei/e6f6df59426b798d3d03ddd0f797304c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rx.Observable.using( | |
function resourceFactory() { | |
return { | |
name: 'my resource', | |
unsubscribe() { | |
console.log("resource disposed"); | |
} | |
}; | |
}, | |
function obsFactory(resource) { | |
return Rx.Observable.of(resource.name); | |
} | |
) | |
.subscribe( | |
(x) => console.log(x) | |
); | |
// output: | |
// my resource | |
// resource disposed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment