Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Provide example for using in plain JavaScript Node.js app #1208

Closed
matthewadams opened this issue Mar 21, 2019 · 5 comments
Closed

Provide example for using in plain JavaScript Node.js app #1208

matthewadams opened this issue Mar 21, 2019 · 5 comments

Comments

@matthewadams
Copy link

This could be an RTFM, but it'd be jim-dandy if you could provide a working example of how to properly use zone.js in a headless, plain JavaScript Node.js app that I'd run in a terminal with node index.js.

https://github.com/angular/zone.js/blob/HEAD/SAMPLE.md contains what appears to be only browser-based examples.

@JiaLiPassion
Copy link
Collaborator

@matthewadams, sure, I will add it! Thanks!

@matthewadams
Copy link
Author

@JiaLiPassion I'm dead in the water right now. If you could throw something together quickly so that I could get going, I'd really appreciate it! :)

Currently, I'm getting undefined for Zone.current.

@JiaLiPassion
Copy link
Collaborator

@matthewadams, here is a very basic sample, https://github.com/JiaLiPassion/zone-node

@matthewadams
Copy link
Author

Ah, ok. By doing require('zone.js/dist/zone-node'), you get a global variable Zone. That's the difference.

Perhaps it's worth updating the documentation to say that? Thanks!

I'll try it out, and reopen this issue if I'm having trouble.

@JiaLiPassion
Copy link
Collaborator

@matthewadams, sure, I will make documentation more clearly, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants