Contentful logo

Contentful Community

JavaScript Client Pushed Updates from Contentful Application

Is there a way to run the JavaScript client locally during development, and have content changes done in the Contentful online client automatically trigger the sync operation? That way when I’m developing and updating content I don’t have to manually trigger a refresh on my local machine when I change content.

For comparison, in datocms, I can pass a --watch parameter and it will run similar to what I described above.

Hey @garnerp,

probably the Sync API is what you’re looking for?

The JS SDK implements it, and to mimic the exact specifics of DatoCMS’s --watch flag, you would only need to find out in which interval it polls for changes, and use it as the delay in setInterval.

One advantage here is, that it doesn’t rely on a specific binary from us and you keep the whole flexibility you may need. Disadvantage is of course, that it has a one-time effort implementing it.