DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
  • Ecosystem
    • can-construct-super
    • can-define-stream
    • can-fixture
    • can-fixture-socket
    • can-jquery
    • can-stache-converters
    • can-stream
      • Methods
        • toStream
        • toStreamFromCompute
        • toStreamFromEvent
        • toStreamFromProperty
    • can-vdom
    • can-view-import
    • can-zone
    • steal-stache
  • Infrastructure
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Ecosystem
  • /
  • can-stream
  • /
  • toStreamFromCompute
  • / On this page
    • toStreamFromCompute

      function

      Creates a stream from can-compute instance which gets updated whenever the compute changes.

      • source

      canStream.toStreamFromCompute( compute )

      Convert a compute into a stream:

      var canStream = require('can-stream');
      var compute = require('can-compute');
      var foo = 'bar';
      var compute1 = compute(foo);
      
      var stream = canStream.toStreamFromCompute(compute1);
      
      stream.onValue(function(value) {
        console.log(value); // -> baz
      });
      
      compute1('baz');
      

      Parameters

      1. compute {can-compute}:

        instance of can-compute.

      Returns

      {Stream}:

      A Kefir stream.

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.