mirror of
https://github.com/liriliri/eruda.git
synced 2026-03-20 09:38:37 +08:00
Add: Code plugin snippet
This commit is contained in:
@@ -111,6 +111,7 @@ It is possible to enhance Eruda with more features by writing plugins. Check sou
|
||||
* [eruda-features](https://github.com/liriliri/eruda-features): Browser feature detections.
|
||||
* [eruda-timing](https://github.com/liriliri/eruda-timing): Show performance and resource timing.
|
||||
* [eruda-memory](https://github.com/liriliri/eruda-memory): Display page memory info.
|
||||
* [eruda-code](https://github.com/liriliri/eruda-code): Run JavaScript code.
|
||||
|
||||
When writing plugins, you can use utilities exposed by Eruda, see [docs](doc/UTIL_API.md) here.
|
||||
|
||||
|
||||
@@ -361,9 +361,11 @@ let evalJs = jsInput =>
|
||||
{
|
||||
let ret;
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
ret = eval.call(window, `(${jsInput})`);
|
||||
} catch (e) {
|
||||
} catch (e)
|
||||
{
|
||||
ret = eval.call(window, jsInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,14 @@ export default [
|
||||
},
|
||||
desc: 'Display memory'
|
||||
},
|
||||
{
|
||||
name: 'Load Code Plugin',
|
||||
fn()
|
||||
{
|
||||
loadPlugin('code');
|
||||
},
|
||||
desc: 'Edit and Run JavaScript'
|
||||
},
|
||||
{
|
||||
name: 'Restore Settings',
|
||||
fn()
|
||||
@@ -193,5 +201,6 @@ let pluginVersion = {
|
||||
fps: '1.0.2',
|
||||
features: '1.0.2',
|
||||
timing: '1.0.1',
|
||||
memory: '1.0.1'
|
||||
memory: '1.0.1',
|
||||
code: '1.0.0'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user