subscription pattern for js impliementation

subscription pattern for easy integration without having to know all the underlying stuff.