Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add indium-update-script-source-hook #46

Merged
merged 3 commits into from
May 12, 2017

Conversation

TatriX
Copy link
Contributor

@TatriX TatriX commented May 12, 2017

Usage:

(add-hook 'indium-update-script-source-hook
	  (lambda (url)
	    (indium-eval (format "window.dispatchEvent(new CustomEvent('patch', {detail: {url: '%s'}}))"
				 url))))

and

window.addEventListener("patch", (event) => {
    console.log("Patched @ " + new Date().toTimeString().substring(0, 8), event.detail);
    // rerender, etc
});

@NicolasPetton
Copy link
Owner

Looks good, thanks!

Could you also add documentation for it?

@TatriX
Copy link
Contributor Author

TatriX commented May 12, 2017

To the texi file?

@NicolasPetton
Copy link
Owner

No, it should be placed in sphinx-doc/code-evaluation.rst.
Then from the sphinx-doc directory, you can run make texinfo (or M-x compile RET make texinfo RET to update the texinfo manual.

(indium-eval (format "window.dispatchEvent(new CustomEvent('patch', {detail: {url: '%s'}}))"
url))))

Then you can use it in your app for developmenm purposes ::
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a typo here :)

@@ -68,3 +68,17 @@ To enable live updates, make sure Indium is set up to use local files (see
current buffer.
- ``(setq indium-update-script-on-save t)``: Automatically update the runtime
script JavaScript source after each buffer save.

You can setup a hook for the script update. For example ::
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about rephrasing this sentence like this: You can setup a hook to be run after each script update. For example ::

@NicolasPetton NicolasPetton mentioned this pull request May 12, 2017
@NicolasPetton
Copy link
Owner

Squash your commits together and we're good to go!

@NicolasPetton NicolasPetton merged commit aeca678 into NicolasPetton:master May 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants