From 905d11c1065810b50afc410d3a24d1939998fada Mon Sep 17 00:00:00 2001 From: Hypnosphi Date: Tue, 23 Jul 2019 14:29:09 +0200 Subject: [PATCH] Add offline mode --- README.md | 5 + examples.md | 34 ++++- src/executable-code/executable-fragment.js | 132 ++++++++++--------- src/executable-code/executable-fragment.monk | 4 +- src/executable-code/index.js | 95 ++++++------- src/index.js | 10 +- 6 files changed, 166 insertions(+), 114 deletions(-) diff --git a/README.md b/README.md index 10817b6b..090ea6de 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,11 @@ playground('.selector', options) ``` +**Options description:** + +- `server` — string, server where the code will be sent to be compiled and analyzed +- `offline` — boolean, if true don't send any requests to server + **Events description:** - `onChange(code)` — Fires every time the content of the editor is changed. Debounce time: 0.5s. diff --git a/examples.md b/examples.md index 39247e11..162d07a3 100644 --- a/examples.md +++ b/examples.md @@ -277,7 +277,39 @@ document.addEventListener('DOMContentLoaded', function() { }); ``` -Add additional hidden files: + +## Offline mode + +You can opt out of any server communication (code completion, execution, etc) by passing an `offline` flag: + +```html + +``` + + +
+ +```kotlin +class Contact(val id: Int, var email: String) + +fun main(args: Array) { + val contact = Contact(1, "mary@gmail.com") + println(contact.id) +} +``` + +
+ + +## Add additional hidden files: Put your files between `