Skip to content

claydotio/netox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

netox

depends on clay-request which depends on whatwg-fetch polyfill

Netox = require 'netox'
netox = new Netox
  headers: {} # optional, lower-cased key-value defaults for server-side calls

# same signature as whatwg-fetch, returns an RxJS observable of clay-request response
netox.stream 'http://x.com/x'
.subscribe (res) -> ...

# same signature as whatwg-fetch, re-fetches streams, returns clay-request response
netox.fetch 'http://x.com/x', {method: 'POST'}
netox.fetch 'http://x.com/x', {isIdempotent: true} # dont re-fetch streams
.then (res) -> ...

# put this in a server-side generated script tag
netox.getSerializationStream()
.map (serialization) ->
  # window['NETOX'] = {...};

# send analytics events with timing info
netox.stream 'http://x.com/x', {isTimed: true}
netox.onTiming ({url, elapsed}) ->
  # hyperplane.emit 'timing', {fields: {url, value: elapsed}}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 100.0%