Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <h1>Observables Example #2</h1>
  We have created 2 subscriptions where first
    <li>transform event into sum of offsets</li>
    <li>filter for those which are bigger than 200</li>
    <li>debounce by 300ms ( => subscribe called no more than once 300ms)</li>
    <li>log sum into subscribe</li>
  and second which just logs all events as they come.
<script src=""></script>





                const source = Rx.Observable.fromEvent(document.body, 'mousemove');

// original example
      value => console.log(`val => x: ${value.offsetX} & y: ${value.offsetY}`),
      error => console.log(error),
      () => console.log('completed')

// log event where sum of offsets is bigger than 200 and debounce by 300ms
  .map(value => value.offsetX + value.offsetY)
  .filter(offsetSum => offsetSum > 200)
      value => console.log(`Offset sum once 300 ms => ${value}`),
      error => console.log(error),
      () => console.log('completed')