GithubHelp home page GithubHelp logo

sublime-jsrun's Introduction

JsRun

Sublime plugin to run JavaScript in the browser

Lets you quickly run code from Sublime directly in the browser. You can use it to experiment with manipulating websites, overriding existing code, or any other crazy things you come up with. Let me know if you use it for anything interesting.

Install

Install JsRun with Package Control and restart Sublime.

Getting started

Select some code or just highlight a line and choose Run JavaScript in the browser in the Command Palette (Cmd+Shift+P). This will then run the command in the active tab in the frontmost browser window. Switch to the browser window to see the result or have them in split-window to see the result instantly.

Remember to open the Console in Dev Tools to see console.log output.

Options

Set your preferred browser in the settings: chrome (default), chrome_canary, safari, opera

(Preferences > Package Settings > JsRun)

Example:

{
	"browser": "chrome_canary"
}

Keyboard shortcut

You can also set up a keyboard shortcut to run the command by opening up "Preferences > Key Bindings - User" and adding your shortcut with the js_run command.

Example:

[
	{
		"keys": ["alt+super+j"],
		"command": "js_run"
	}
]

Supported browsers

Currently supports Chrome, Chrome Canary, Safari and Opera on OS X. Firefox doesn't expose JS to AppleScript.

License

MIT © Sindre Sorhus

sublime-jsrun's People

Contributors

sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublime-jsrun's Issues

Upgrade to ST3

I'm planning on upgrading the plugin, but want to wait until the worst bugs are ironed out.

From looking at the forum, ST3 was an annoyingly buggy release.

config

First off, thanks for this project.

My issue: It's not clear what the config file should look like.

After I installed JSRun, my config is empty.

The README says...

Options

Set your preferred browser in the settings: chrome (default), chrome_canary, safari, opera
(Preferences > Package Settings > JsRun > Settings - User)

Does that actually mean the config should read

safari

or

"safari"

or is it

{
  "browser": "safari"
}

or something.

The README suggests the first example but these config files are supposed to be valid JSON and only the last example is.

Screencast

Screencast on how to use it. I've noticed some don't get what it is and how it's useful.

Windows Support

I'm guessing (because of: "Firefox doesn't expose JS to AppleScript.") that this doesn't work on windows. I suggest making that statement in the readme, because sublime is multiplataform.

Linux support

Would love to have this, but not a Linux user. Patch more than welcome!

Add global keyboard shortcut

It would be awesome if something like ctrl+shift+j could be a global shortcut to run the command.
I couldn't figure out how to set the shortcut in the user key-bindings and I think it would improve the workflow immensely.

Windows support

Lots of Sublime users are on Windows. Not sure if it's even possible.

If anyone have any suggestions or want to do this let me know. Patch welcome :)

I can't find the plugin

I have ST2 and can't find the plugin in the package control. Is there any way to fix that?

Focus browser

Some might expect the browser to focus when the command is run. It currently doesn't do that.

Even though I mostly use it in split screen, some might want it to focus.

There are two ways for this to work:

  1. Option a user can set to always focus or not.
  2. A separate command that runs the code and focus, like Run JavaScript in the browser and focus

Nothing happens after selecting "run Javascript in browser"

On a mac, installed just fine, no errors in sublime console. Default settings set to use Chrome which is what I wanted so I didn't touch anything.

  • Highlight some js,
  • hit cmd-shift-p to open go menu,
  • type run,
  • pick "Run Javascript in browser" from drop down.

Nothing happens. Focus stays in sublime. No entries in console. Hop to chrome and see no change in browser.

What am I doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.