The omg Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The omg Reference Manual

This is the omg Reference Manual, version 0.1.8, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 05:27:55 2022 GMT+0.

Table of Contents


1 Introduction

OMGlib

A Common Lisp library to build fully dynamic web interfaces

The main idea of this library is to vanish a border between frontend and backend as much as possible. You can develop a CL application using REPL and SLIME on a backend, but some of you functions and macros can be declared as browser-side (b-s) with defun-f and defmacro-f respectively:

(require :omg)
(defpackage mytest (:use cl omg))
(in-package :mytest)
(defun-f js-add (x y)
  (+ x y)) ;; this code will be executed in a browser

The (start-server) function starts clack web server on default port 7500 (can be changed by setting omg::*port* variable). Now, in the html-code you can inject the following line:

<script src='http://localhost:7500/j' type='text/javascript'></script>

or just open a page http://localhost:7500/ (a blank page with js-injection code).

Now you call a browser-side function, just executing it in REPL, for example:

MYTEST> (js-add 1 2)
;; (3)

The function call will be converted to javascript with JSCL and sent to the browser via websocket, where the code will be executed and result will be returned to the backend. The result in this example will be returned as a list, because we are not specified a session (see below) and the code will be executed in all connected browsers, and the list of result values will be returned.

The more complicated example you can find in in example.lisp file, where omgui package is used to manipulate DOM objects.

OMGUI package

OMG package is all-sufficient and can be used as is to control a frontend. You can execute any JS code on the browser-side using JSCL FFI:

(defun-f jslog (&rest args) ;; call console.log(...args)
  "Log function for js"
  (apply (jscl::oget (jscl::%js-vref "console") "log") args)
  nil)

But many of useful JS and DOM-manipulating functions are provided by omgui package, where you can find the following functions:

Creating SVG elements

You can create SVG elements with make-svg function. The function accepts parameter pairs like :|attributename| value for attributes and (tag-name ...attributes and subtags) for inner elements. A string parameter will be inserted as a tag body. For exanple, the following code will return SVG-object with circle:

(make-svg :|viewBox| "0 0 100 100"
          '(circle :|cx| 50 :|cy| 50 :|r| 50 :|fill| "red"))

The following function returns animated spinner:

(defun-f make-spinner ()
  (let* ((width 20)
         (ncirc 10)
         (r (/ width 2))
         (rc (/ width 6)))
    (apply #'make-svg
           `(:|viewBox| ,(format nil "0 0 ~A ~A" width width)
             ,@(loop for i below ncirc
                     for ang = (* i (/ (* 2 pi) ncirc))
                     collect
                 `(circle :|cx| ,(+ r (* (- r rc) (jscos ang)))
                          :|cy| ,(+ r (* -1 (- r rc) (jssin ang)))
                          :|r| 0
                          :|fill| "#505050"
                          (animate :|attributeName| "r"
                                   :|from| ,rc
                                   :|to| ,(* rc (/ 3 (+ ncirc 2)))
                                   :|begin| ,(format nil "~As" (/ (- ncirc i 1) ncirc))
                                   :|dur| "1s"
                                   :|repeatCount| "indefinite")
                          (animate :|attributeName| "fill-opacity"
                                   :|from| 1
                                   :|to| 0
                                   :|begin| ,(format nil "~As" (/ (- ncirc i 1) ncirc))
                                   :|dur| "1s"
                                   :|repeatCount| "indefinite")))))))

To include text nodes use a string:

'(text (:|textPath| :|href| "#MyTextCurve" "The curved text!"))

Modal dialogs

You can display modal dialog in the browser using the modal-dialog macro:

(in-debug-session
  (print (modal-dialog "Dialog header"
                       "Dialog text"))
                       :lines (list :line1 "field 1"
                                    :line2 "field 2"
                                    :buttons (list (list "OK" #'dialog-ok)
                                                   (list "Cancel" #'close-current-dialog))))
;; ((:line1 "Text in the line 1"))
    (:line2 "Text in the line 2")

This code will display a modal dialog in debug session and print the result, returned as a plist or nil if the Cancel button was pressed.

You can provide validation functions for input lines in the form ... :line1 (list "field1" #'func), where #'func can be a browser-side or RPC function. Also you can provide (lambda (s) ...) as a validator function, and even a #'any-backend-function but you will get a security warning in last case. The function must accept a string as an argument and return an (optionally) modified string which will replace the string in the input field. See the example.lisp.

You callbacks can use the following supplementary functions:

Yotube player

Restrictions

How it works

There are the following macros to define browser-side functions, macros and variables:

Also you can define RPC-functions, with

Browser-side functions

defun-f has similar syntax as a defun, but defines macro with the same name, instead of function. The macro has to check its arguments and evaluate only some of them on backend, passing the rest to the browser-side as is. For example:

(some-bs-function "value1" ;; will be passed as is
                  (some-backend-function) ;; will be evaluated on backend and the result will be passed as a parameter
                  (another-bs-function) ;; will be passed as is and evaluated on browser-side
                  #'another-bs-function ;; will be passed as is
                  (lambda (x) (+ x 1)) ;; will be passed as is and evaluated on browser-side
                  #'another-backend-function) ;; will be automatically converted to RPC-call, security warning will be printed

Just after websocket connection, the browser-side has no declared symbols and functions. When you trying to execute (some-bs-function) the symbol some-bs-function will be undeclared (in browser) and the library will ask backend for the symbol via synchronous XHR query and will get it as an already compiled to JS code. You can change this behavior by setting the omg::*local-compile* variable to nil, after that the CL code will be sent as is and compiled in browser before execution. This can provide a bit more compatibility, but code compilation will be much slower. The omg::*local-compile* may be changed on-the-fly without browser page reloading.

The library determines which symbols must be fetched from backend just by their packages: if the package still not exists, it will be created on-the-fly with defpackage, cl and jscl packages will be used. All created packages will be marked as remote and the library will try to fetch unknown symbols from that packages from the backend. This is the reason, why you cannot define browser-side functions just in CL-USER.

The CLOS is not implemented in browser-side. It is implemented in JSCL, but I see no way to catch access to undefined methods if several methods are defined with same names. If you are know how to implement this - tell me :)

Browser-side macros

Browser-side macros are called while code is compiled to JS and must be evaluated on the browser side. So, if you are use such macros while the omg::*local-compile* is set to T (by default), JSCL will parse the code and execute code of each macro in the browser, get the results and finish the compilation using them. This means that while local compilation is enabled, macro expansion will be rather expensive, especially, if you are using recursive macros. Also, all of the macro output must be transferred from the browser to the host, so you cannot use just (gensym) to generate temporary symbols, they are must be interned to be properly transferred. Intern all of your symbols manually or just use helper function (gensym2) from OMGUI package.

Browser-side variables and parameters

You can declare browser-side variables and parameters with defvar-f and defparameter-f. They a similar to standard defvar and defparameter, but the symbols will be available to browser-side functions. This is one-way availability: if the variable will be changed on browser-side, backend will see no update, also, the data will not be updated on other connected browsers. If you are changing such variable or parameter on the backend, the changes will be seen only for newly connected browsers or by browser, which are not fetched they yet.

RPC functions

Due to security reasons, you can call only some specially marked functions of backend from browser side. You can declare them with defun-r macro, which acts as standard defun, but places the function name in the list of allowed RPC functions. The RPC function can be simply called on browser-side as any other function.

Also, you can asynchronously call any RPC function using async-bind macro:

(async-bind (res (some-rpc-function arg1 arg2))
  (jslog res) ;; The code will be executed asynchronously after RPC call completion

Sessions

Each connected browser starts a new session which is determined by unique random symbol - session ID. When RPC-function is called from browser-side, it will be executed in the session context, so, it will execute all bs-functions in the specific browser. You can implicitly set the current session by executing a code inside with-session macro:

(with-session (find-session 'ASDXCASA) ;; find a session object by ID
  (some-bs-function)) ;; will be called in session 'ASDXCASA

If you are executing bs-function without session, it will be executed in ALL connected browsers and a list of results will be returned.

The library provides some other utility functions to work with sessions:

To define global server-side variable, which value will be different for different sessions, use def-session-var macro:

(def-session-var *search-in-progress* nil)

The macro will create a symbol-macro with name *search-in-progress* and a hash table to store values for each session. Now you can use *search-in-progress* as a normal setf-able variable.

WARNING: use init value with caution! Value, passed as a third (optional) parameter of def-session-var will be evaluated with every access to the variable!

Boot functions

Just after connection, the some boot code will be executed in browser. You can control this using the following functions:

REMOTE-EXEC function

You can use (remote-exec cmd [nowait]) function to execute any CL code cmd in the browser. This function has optional argument nowait - set it to T if you are not needed to return value(s) and the function will return nil immediately.

Adding a custom HTML into default document body

The default HTML page returned for "/" just contains the main js script link, but you can add any extra HTML into document body, for example to display "Loading..." message:

 (add-to-root-html "<span id='loadBanner'>The page is loading, please wait...</span>")
 (add-to-boot '(remove-element (js-get-element-by-id "loadBanner")))

PWA mode

The library can be used to create Progressive Web App (PWA), just by adding one single function call:

  (make-pwa (:name "Application Name" :short-name "Application Short Name" :display "standalone" :theme-color "#000000" :background-color "#ffffff" :icon-path "/path/to/icon/file.png")

All of the arguments are optional (default values will be used), but to get installable app you need to provide a path to icon file. Now only .png .jpeg and .gif image formats are accepted.

Worker process sending broadcast message for every fetch request, the app can listen for them with the following code:

(setf (jscl::oget (jscl::make-new (jscl::oget (jscl::%js-vref "window") "BroadcastChannel")
                                    (jscl::lisp-to-js "omg_service_worker"))
                  "onmessage")
      (lambda (msg)
        (let ((typ (jscl::oget msg "data" "type")))
          (if (equal typ "fetch")
              (let ((uri (jscl::oget msg "data" "uri")))
                (jslog "FETCH:" uri))))))

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 omg

A Common Lisp library to build fully dynamic web interfaces

Author

Pavel Kaygorodov <hemml@me.com>

Home Page

https://github.com/hemml/OMGlib

Source Control

https://github.com/hemml/OMGlib.git

License

GPLv3

Version

0.1.8

Dependencies
  • clack (system).
  • websocket-driver-server (system).
  • bordeaux-threads (system).
  • trivial-utf-8 (system).
  • media-types (system).
  • pngload (system).
  • skippy (system).
  • cl-jpeg (system).
Source

omg.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Next: , Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 omg/omg.asd

Source

omg.asd.

Parent Component

omg (system).

ASDF Systems

omg.


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.2 omg/omg.lisp

Source

omg.asd.

Parent Component

omg (system).

Packages

omg.

Public Interface
Internals

Previous: , Up: Lisp   [Contents][Index]

3.1.3 omg/omgui.lisp

Dependency

omg.lisp (file).

Source

omg.asd.

Parent Component

omg (system).

Packages

omgui.

Public Interface
Internals

Previous: , Up: Files   [Contents][Index]

3.2 Static


Next: , Previous: , Up: Static   [Contents][Index]

3.2.1 omg/README.md

Source

omg.asd.

Parent Component

omg (system).


Previous: , Up: Static   [Contents][Index]

3.2.2 omg/LICENSE

Source

omg.asd.

Parent Component

omg (system).


4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 omg

Source

omg.lisp.

Use List
  • bordeaux-threads.
  • clack.
  • common-lisp.
  • trivial-utf-8.
  • websocket-driver.
Used By List

omgui.

Public Interface
Internals

Previous: , Up: Packages   [Contents][Index]

4.2 omgui

Source

omgui.lisp.

Use List
  • bordeaux-threads.
  • common-lisp.
  • jscl.
  • omg.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Macros

Macro: add-style (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: add-youtube-player (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: allow-page-close (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: append-element (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: async-bind (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: browser-case (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: check-element (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: close-current-dialog (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: create-element (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: def-session-var (vr &optional init)
Package

omg.

Source

omg.lisp.

Macro: defconstant-f (name val)
Package

omg.

Source

omg.lisp.

Macro: defmacro-f (name args &rest body)
Package

omg.

Source

omg.lisp.

Macro: defparameter-f (name val)
Package

omg.

Source

omg.lisp.

Macro: defun-f (name args &rest body)
Package

omg.

Source

omg.lisp.

Macro: defun-r (name args &rest body)

Define a server-side function and allow to call it from browser side

Package

omg.

Source

omg.lisp.

Macro: defvar-f (name val)
Package

omg.

Source

omg.lisp.

Macro: disable-back-button (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: disable-scroll (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: element-height (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: element-width (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: enable-back-button (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: enable-scroll (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: execute-after (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: gensym2 (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: get-dialog-data (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: get-element-id (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: in-debug-session (&rest body)
Package

omg.

Source

omg.lisp.

Macro: js-get-element-by-id (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: js-parse-float (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jsacos (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jsasin (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jsatan (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jsatan2 (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jscos (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jsfloor (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jsln (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jslog (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jsmax (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jsmin (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jsrandom (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jssin (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: jstan (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: load-js-script (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: local-storage (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: make-dialog (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: make-js-function (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: make-js-object (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: make-svg (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: modal-dialog (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: page-height (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: page-width (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: parent-element (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: prevent-page-close (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: register-hash-cb (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: remove-element (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: visible-height (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: visible-left (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: visible-top (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: visible-width (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: winref (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: with-session (sess &rest body)

Execute commands inside session sess

Package

omg.

Source

omg.lisp.


5.1.2 Ordinary functions

Function: add-to-boot (f)
Package

omg.

Source

omg.lisp.

Function: add-to-root-html (html)
Package

omg.

Source

omg.lisp.

Function: current-session-id ()
Package

omg.

Source

omg.lisp.

Function: dialog-ok ()
Package

omgui.

Source

omgui.lisp.

Function: find-session (sid)

Return session object with specific ID

Package

omg.

Source

omg.lisp.

Function: kill-server ()
Package

omg.

Source

omg.lisp.

Function: make-pwa (&key name short-name display theme-color background-color icon-path)
Package

omg.

Source

omg.lisp.

Function: remote-exec (cmd &optional nowait)

Execute the code on the browser-side. If the *current-session* set, the code will be executed
within the specific session, otherwise, the code will be executed in all sessions and all the return values are returned as a list. If the nowait is T, the function will retrurn NIL immediately, without waiting result from the remote side.

Package

omg.

Source

omg.lisp.

Function: restart-server (&rest args)
Package

omg.

Source

omg.lisp.

Function: rm-from-boot (f)
Package

omg.

Source

omg.lisp.

Function: set-debug-session (sid)
Package

omg.

Source

omg.lisp.

Function: start-server (&rest args)
Package

omg.

Source

omg.lisp.


5.1.3 Standalone methods

Reader Method: socket ((omg-session omg-session))

automatically generated reader method

Package

websocket-driver.ws.base.

Source

omg.lisp.

Target Slot

socket.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Constants

Constant: sid-length
Package

omg.

Source

omg.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.2 Special variables

Special Variable: *backcnt*
Package

omgui.

Source

omgui.lisp.

Special Variable: *beforeunload-installed*
Package

omgui.

Source

omgui.lisp.

Special Variable: *boot-functions*
Package

omg.

Source

omg.lisp.

Special Variable: *current-dialog*
Package

omgui.

Source

omgui.lisp.

Special Variable: *current-res*
Package

omg.

Source

omg.lisp.

Special Variable: *current-session*
Package

omg.

Source

omg.lisp.

Special Variable: *debug-session-id*
Package

omg.

Source

omg.lisp.

Special Variable: *dialog-stack*
Package

omgui.

Source

omgui.lisp.

Special Variable: *dialog-wait-list*
Package

omgui.

Source

omgui.lisp.

Special Variable: *disable-back*
Package

omgui.

Source

omgui.lisp.

Special Variable: *disable-page-unload*
Package

omgui.

Source

omgui.lisp.

Special Variable: *exportable-expressions*
Package

omg.

Source

omg.lisp.

Special Variable: *exported-function-names*
Package

omg.

Source

omg.lisp.

Special Variable: *extra-html*
Package

omg.

Source

omg.lisp.

Special Variable: *fback*
Package

omgui.

Source

omgui.lisp.

Special Variable: *giant-hash-lock*
Package

omg.

Source

omg.lisp.

Special Variable: *gimme-path*
Package

omg.

Source

omg.lisp.

Special Variable: *gimme-wait-list*
Package

omg.

Source

omg.lisp.

Special Variable: *hash-change-cbs*
Package

omgui.

Source

omgui.lisp.

Special Variable: *html-path*
Package

omg.

Source

omg.lisp.

Special Variable: *in-f-macro*
Package

omg.

Source

omg.lisp.

Special Variable: *in-rpc*
Package

omg.

Source

omg.lisp.

Special Variable: *js-path*
Package

omg.

Source

omg.lisp.

Special Variable: *last-args*
Package

omg.

Source

omg.lisp.

Special Variable: *local-compile*
Package

omg.

Source

omg.lisp.

Special Variable: *local-lambdas*
Package

omg.

Source

omg.lisp.

Special Variable: *onpopstate-installed*
Package

omgui.

Source

omgui.lisp.

Special Variable: *port*
Package

omg.

Source

omg.lisp.

Special Variable: *pwa-icon*
Package

omg.

Source

omg.lisp.

Special Variable: *pwa-icon-file*
Package

omg.

Source

omg.lisp.

Special Variable: *pwa-icon-type*
Package

omg.

Source

omg.lisp.

Special Variable: *pwa-mainfest*
Package

omg.

Source

omg.lisp.

Special Variable: *pwa-name*
Package

omg.

Source

omg.lisp.

Special Variable: *pwa-path*
Package

omg.

Source

omg.lisp.

Special Variable: *pwa-sw-js*
Package

omg.

Source

omg.lisp.

Special Variable: *pwa-sw-js-name*
Package

omg.

Source

omg.lisp.

Special Variable: *root-path*
Package

omg.

Source

omg.lisp.

Special Variable: *rpc-functions*
Package

omg.

Source

omg.lisp.

Special Variable: *rpc-path*
Package

omg.

Source

omg.lisp.

Special Variable: *scroll-disabled*
Package

omgui.

Source

omgui.lisp.

Special Variable: *serv*
Package

omg.

Source

omg.lisp.

Special Variable: *session-list*
Package

omg.

Source

omg.lisp.

Special Variable: *ssl-cert*
Package

omg.

Source

omg.lisp.

Special Variable: *ssl-key*
Package

omg.

Source

omg.lisp.

Special Variable: *style-cache*
Package

omgui.

Source

omgui.lisp.

Special Variable: *takit-path*
Package

omg.

Source

omg.lisp.

Special Variable: *takit-wait-list*
Package

omg.

Source

omg.lisp.

Special Variable: *use-wss*
Package

omg.

Source

omg.lisp.

Special Variable: *ws-path*
Package

omg.

Source

omg.lisp.

Special Variable: *youtube-js-loaded*
Package

omgui.

Source

omgui.lisp.


5.2.3 Macros

Macro: curtain (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: deep-oget-1 (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: dialog-frame (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: dialog-header (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: dialog-table (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: form-button-row (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: form-line (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: js-string-split (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: make-def-macro-f (op)

Just a macro to generate macros for f-functions and f-macros definintions (defun-f, defmacro-f, etc...)

Package

omg.

Source

omg.lisp.

Macro: make-var-macro-f (op)

A macro for variables-parameters-constants definitions

Package

omg.

Source

omg.lisp.

Macro: random-id (&rest args)
Package

omgui.

Source

omgui.lisp.

Macro: system-font (&rest args)
Package

omgui.

Source

omgui.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.4 Ordinary functions

Function: boot-f ()

The boot code, will be executed on the browser-side just after the socket is connected.

Package

omg.

Source

omg.lisp.

Function: compile-to-js (code pkg &optional reskey)

Return JS for the code, pkg is current package for compilation context.
The reskey is the *gimme-wait-list* key, the place to store compilation result.

Package

omg.

Source

omg.lisp.

Function: dialog-wl-send (id dat)
Package

omgui.

Source

omgui.lisp.

Function: exec-local-lambda (idargs)
Package

omg.

Source

omg.lisp.

Function: exec-remote-macro (name args)

Execute in a browser a code of the macro with the specific name and argments.
Called by JSCL compiler while compling lisp code to JS. We have to execute macros on the browser-side, because all side-effects, produced by macros, must have a place in the browser.

Package

omg.

Source

omg.lisp.

Function: f-eval (arg)

Smart-eval – evaluate everything, but expotrable expressions, lambdas and function names

Package

omg.

Source

omg.lisp.

Function: get-main-js ()

Return the JS code, including JSCL and OMG parts glued.

Package

omg.

Source

omg.lisp.

Function: get-root-html ()

Return a somple HTML with JS injected.

Package

omg.

Source

omg.lisp.

Function: get-str-from (s len)
Package

omg.

Source

omg.lisp.

Function: gethash-lock (key hash)
Package

omg.

Source

omg.lisp.

Function: (setf gethash-lock) (key hash)
Package

omg.

Source

omg.lisp.

Function: gimme (sym)

The handler for gimme-requests, which are used to request unknown symbols from the server-side.

Package

omg.

Source

omg.lisp.

Function: has-ssl-p ()
Package

omg.

Source

omg.lisp.

Function: make-ws (env)

Return the websocket for the new session. Also, creates the session object.

Package

omg.

Source

omg.lisp.

Function: random-key (h &optional len)

Make a random hash-table key

Package

omg.

Source

omg.lisp.

Function: random-string (len)

Generate a random stgring of length len

Package

omg.

Source

omg.lisp.

Function: random-symbol (len)

Make a random symbol

Package

omg.

Source

omg.lisp.

Function: register-rpc (name)
Package

omg.

Source

omg.lisp.

Function: remote-unintern (sym)

Unintern the symbol within all active sessions, mandatory to reflect symbol redefinition. The next try to intern the symbol in browser-side will cause new symbol fetch.

Package

omg.

Source

omg.lisp.

Function: replace-all (string part replacement &key test)

Returns a new string in which all the occurences of the part is replaced with replacement.

Package

omg.

Source

omg.lisp.

Function: rpc-wrapper (op args pkg)

The wrapper for RPC requests, used to allow call browser-side functions from RPC funcs.

Package

omg.

Source

omg.lisp.

Function: serv (env)
Package

omg.

Source

omg.lisp.

Function: takit (key res)

The handler for takit-requests. This requests are used to return macro expansion results from browser-side

Package

omg.

Source

omg.lisp.

Function: use-wss-p ()
Package

omg.

Source

omg.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.5 Generic functions

Generic Reader: get-id (object)
Package

omg.

Methods
Reader Method: get-id ((omg-session omg-session))

automatically generated reader method

Source

omg.lisp.

Target Slot

ses-id.

Generic Reader: wait-list (object)
Package

omg.

Methods
Reader Method: wait-list ((omg-session omg-session))

automatically generated reader method

Source

omg.lisp.

Target Slot

wait-list.


Previous: , Up: Internals   [Contents][Index]

5.2.6 Classes

Class: omg-session

The session object, holding the session socket, the wait-list holding semaphores and storing result data from remote-exec calls

Package

omg.

Source

omg.lisp.

Direct methods
Direct slots
Slot: socket
Package

websocket-driver.ws.base.

Initform

(error "socket required")

Initargs

:socket

Readers

socket.

Writers

This slot is read-only.

Slot: ses-id
Initform

(omg::random-symbol omg::|sid-length|)

Readers

get-id.

Writers

This slot is read-only.

Slot: wait-list
Initform

(make-hash-table)

Readers

wait-list.

Writers

This slot is read-only.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
A   B   C   D   E   F   G   H   I   J   K   L   M   P   R   S   T   U   V   W  
Index Entry  Section

(
(setf gethash-lock): Private ordinary functions

A
add-style: Public macros
add-to-boot: Public ordinary functions
add-to-root-html: Public ordinary functions
add-youtube-player: Public macros
allow-page-close: Public macros
append-element: Public macros
async-bind: Public macros

B
boot-f: Private ordinary functions
browser-case: Public macros

C
check-element: Public macros
close-current-dialog: Public macros
compile-to-js: Private ordinary functions
create-element: Public macros
current-session-id: Public ordinary functions
curtain: Private macros

D
deep-oget-1: Private macros
def-session-var: Public macros
defconstant-f: Public macros
defmacro-f: Public macros
defparameter-f: Public macros
defun-f: Public macros
defun-r: Public macros
defvar-f: Public macros
dialog-frame: Private macros
dialog-header: Private macros
dialog-ok: Public ordinary functions
dialog-table: Private macros
dialog-wl-send: Private ordinary functions
disable-back-button: Public macros
disable-scroll: Public macros

E
element-height: Public macros
element-width: Public macros
enable-back-button: Public macros
enable-scroll: Public macros
exec-local-lambda: Private ordinary functions
exec-remote-macro: Private ordinary functions
execute-after: Public macros

F
f-eval: Private ordinary functions
find-session: Public ordinary functions
form-button-row: Private macros
form-line: Private macros
Function, (setf gethash-lock): Private ordinary functions
Function, add-to-boot: Public ordinary functions
Function, add-to-root-html: Public ordinary functions
Function, boot-f: Private ordinary functions
Function, compile-to-js: Private ordinary functions
Function, current-session-id: Public ordinary functions
Function, dialog-ok: Public ordinary functions
Function, dialog-wl-send: Private ordinary functions
Function, exec-local-lambda: Private ordinary functions
Function, exec-remote-macro: Private ordinary functions
Function, f-eval: Private ordinary functions
Function, find-session: Public ordinary functions
Function, get-main-js: Private ordinary functions
Function, get-root-html: Private ordinary functions
Function, get-str-from: Private ordinary functions
Function, gethash-lock: Private ordinary functions
Function, gimme: Private ordinary functions
Function, has-ssl-p: Private ordinary functions
Function, kill-server: Public ordinary functions
Function, make-pwa: Public ordinary functions
Function, make-ws: Private ordinary functions
Function, random-key: Private ordinary functions
Function, random-string: Private ordinary functions
Function, random-symbol: Private ordinary functions
Function, register-rpc: Private ordinary functions
Function, remote-exec: Public ordinary functions
Function, remote-unintern: Private ordinary functions
Function, replace-all: Private ordinary functions
Function, restart-server: Public ordinary functions
Function, rm-from-boot: Public ordinary functions
Function, rpc-wrapper: Private ordinary functions
Function, serv: Private ordinary functions
Function, set-debug-session: Public ordinary functions
Function, start-server: Public ordinary functions
Function, takit: Private ordinary functions
Function, use-wss-p: Private ordinary functions

G
Generic Function, get-id: Private generic functions
Generic Function, wait-list: Private generic functions
gensym2: Public macros
get-dialog-data: Public macros
get-element-id: Public macros
get-id: Private generic functions
get-id: Private generic functions
get-main-js: Private ordinary functions
get-root-html: Private ordinary functions
get-str-from: Private ordinary functions
gethash-lock: Private ordinary functions
gimme: Private ordinary functions

H
has-ssl-p: Private ordinary functions

I
in-debug-session: Public macros

J
js-get-element-by-id: Public macros
js-parse-float: Public macros
js-string-split: Private macros
jsacos: Public macros
jsasin: Public macros
jsatan: Public macros
jsatan2: Public macros
jscos: Public macros
jsfloor: Public macros
jsln: Public macros
jslog: Public macros
jsmax: Public macros
jsmin: Public macros
jsrandom: Public macros
jssin: Public macros
jstan: Public macros

K
kill-server: Public ordinary functions

L
load-js-script: Public macros
local-storage: Public macros

M
Macro, add-style: Public macros
Macro, add-youtube-player: Public macros
Macro, allow-page-close: Public macros
Macro, append-element: Public macros
Macro, async-bind: Public macros
Macro, browser-case: Public macros
Macro, check-element: Public macros
Macro, close-current-dialog: Public macros
Macro, create-element: Public macros
Macro, curtain: Private macros
Macro, deep-oget-1: Private macros
Macro, def-session-var: Public macros
Macro, defconstant-f: Public macros
Macro, defmacro-f: Public macros
Macro, defparameter-f: Public macros
Macro, defun-f: Public macros
Macro, defun-r: Public macros
Macro, defvar-f: Public macros
Macro, dialog-frame: Private macros
Macro, dialog-header: Private macros
Macro, dialog-table: Private macros
Macro, disable-back-button: Public macros
Macro, disable-scroll: Public macros
Macro, element-height: Public macros
Macro, element-width: Public macros
Macro, enable-back-button: Public macros
Macro, enable-scroll: Public macros
Macro, execute-after: Public macros
Macro, form-button-row: Private macros
Macro, form-line: Private macros
Macro, gensym2: Public macros
Macro, get-dialog-data: Public macros
Macro, get-element-id: Public macros
Macro, in-debug-session: Public macros
Macro, js-get-element-by-id: Public macros
Macro, js-parse-float: Public macros
Macro, js-string-split: Private macros
Macro, jsacos: Public macros
Macro, jsasin: Public macros
Macro, jsatan: Public macros
Macro, jsatan2: Public macros
Macro, jscos: Public macros
Macro, jsfloor: Public macros
Macro, jsln: Public macros
Macro, jslog: Public macros
Macro, jsmax: Public macros
Macro, jsmin: Public macros
Macro, jsrandom: Public macros
Macro, jssin: Public macros
Macro, jstan: Public macros
Macro, load-js-script: Public macros
Macro, local-storage: Public macros
Macro, make-def-macro-f: Private macros
Macro, make-dialog: Public macros
Macro, make-js-function: Public macros
Macro, make-js-object: Public macros
Macro, make-svg: Public macros
Macro, make-var-macro-f: Private macros
Macro, modal-dialog: Public macros
Macro, page-height: Public macros
Macro, page-width: Public macros
Macro, parent-element: Public macros
Macro, prevent-page-close: Public macros
Macro, random-id: Private macros
Macro, register-hash-cb: Public macros
Macro, remove-element: Public macros
Macro, system-font: Private macros
Macro, visible-height: Public macros
Macro, visible-left: Public macros
Macro, visible-top: Public macros
Macro, visible-width: Public macros
Macro, winref: Public macros
Macro, with-session: Public macros
make-def-macro-f: Private macros
make-dialog: Public macros
make-js-function: Public macros
make-js-object: Public macros
make-pwa: Public ordinary functions
make-svg: Public macros
make-var-macro-f: Private macros
make-ws: Private ordinary functions
Method, get-id: Private generic functions
Method, socket: Public standalone methods
Method, wait-list: Private generic functions
modal-dialog: Public macros

P
page-height: Public macros
page-width: Public macros
parent-element: Public macros
prevent-page-close: Public macros

R
random-id: Private macros
random-key: Private ordinary functions
random-string: Private ordinary functions
random-symbol: Private ordinary functions
register-hash-cb: Public macros
register-rpc: Private ordinary functions
remote-exec: Public ordinary functions
remote-unintern: Private ordinary functions
remove-element: Public macros
replace-all: Private ordinary functions
restart-server: Public ordinary functions
rm-from-boot: Public ordinary functions
rpc-wrapper: Private ordinary functions

S
serv: Private ordinary functions
set-debug-session: Public ordinary functions
socket: Public standalone methods
start-server: Public ordinary functions
system-font: Private macros

T
takit: Private ordinary functions

U
use-wss-p: Private ordinary functions

V
visible-height: Public macros
visible-left: Public macros
visible-top: Public macros
visible-width: Public macros

W
wait-list: Private generic functions
wait-list: Private generic functions
winref: Public macros
with-session: Public macros

Jump to:   (  
A   B   C   D   E   F   G   H   I   J   K   L   M   P   R   S   T   U   V   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
C   S   W  
Index Entry  Section

*
*backcnt*: Private special variables
*beforeunload-installed*: Private special variables
*boot-functions*: Private special variables
*current-dialog*: Private special variables
*current-res*: Private special variables
*current-session*: Private special variables
*debug-session-id*: Private special variables
*dialog-stack*: Private special variables
*dialog-wait-list*: Private special variables
*disable-back*: Private special variables
*disable-page-unload*: Private special variables
*exportable-expressions*: Private special variables
*exported-function-names*: Private special variables
*extra-html*: Private special variables
*fback*: Private special variables
*giant-hash-lock*: Private special variables
*gimme-path*: Private special variables
*gimme-wait-list*: Private special variables
*hash-change-cbs*: Private special variables
*html-path*: Private special variables
*in-f-macro*: Private special variables
*in-rpc*: Private special variables
*js-path*: Private special variables
*last-args*: Private special variables
*local-compile*: Private special variables
*local-lambdas*: Private special variables
*onpopstate-installed*: Private special variables
*port*: Private special variables
*pwa-icon*: Private special variables
*pwa-icon-file*: Private special variables
*pwa-icon-type*: Private special variables
*pwa-mainfest*: Private special variables
*pwa-name*: Private special variables
*pwa-path*: Private special variables
*pwa-sw-js*: Private special variables
*pwa-sw-js-name*: Private special variables
*root-path*: Private special variables
*rpc-functions*: Private special variables
*rpc-path*: Private special variables
*scroll-disabled*: Private special variables
*serv*: Private special variables
*session-list*: Private special variables
*ssl-cert*: Private special variables
*ssl-key*: Private special variables
*style-cache*: Private special variables
*takit-path*: Private special variables
*takit-wait-list*: Private special variables
*use-wss*: Private special variables
*ws-path*: Private special variables
*youtube-js-loaded*: Private special variables

C
Constant, sid-length: Private constants

S
ses-id: Private classes
sid-length: Private constants
Slot, ses-id: Private classes
Slot, socket: Private classes
Slot, wait-list: Private classes
socket: Private classes
Special Variable, *backcnt*: Private special variables
Special Variable, *beforeunload-installed*: Private special variables
Special Variable, *boot-functions*: Private special variables
Special Variable, *current-dialog*: Private special variables
Special Variable, *current-res*: Private special variables
Special Variable, *current-session*: Private special variables
Special Variable, *debug-session-id*: Private special variables
Special Variable, *dialog-stack*: Private special variables
Special Variable, *dialog-wait-list*: Private special variables
Special Variable, *disable-back*: Private special variables
Special Variable, *disable-page-unload*: Private special variables
Special Variable, *exportable-expressions*: Private special variables
Special Variable, *exported-function-names*: Private special variables
Special Variable, *extra-html*: Private special variables
Special Variable, *fback*: Private special variables
Special Variable, *giant-hash-lock*: Private special variables
Special Variable, *gimme-path*: Private special variables
Special Variable, *gimme-wait-list*: Private special variables
Special Variable, *hash-change-cbs*: Private special variables
Special Variable, *html-path*: Private special variables
Special Variable, *in-f-macro*: Private special variables
Special Variable, *in-rpc*: Private special variables
Special Variable, *js-path*: Private special variables
Special Variable, *last-args*: Private special variables
Special Variable, *local-compile*: Private special variables
Special Variable, *local-lambdas*: Private special variables
Special Variable, *onpopstate-installed*: Private special variables
Special Variable, *port*: Private special variables
Special Variable, *pwa-icon*: Private special variables
Special Variable, *pwa-icon-file*: Private special variables
Special Variable, *pwa-icon-type*: Private special variables
Special Variable, *pwa-mainfest*: Private special variables
Special Variable, *pwa-name*: Private special variables
Special Variable, *pwa-path*: Private special variables
Special Variable, *pwa-sw-js*: Private special variables
Special Variable, *pwa-sw-js-name*: Private special variables
Special Variable, *root-path*: Private special variables
Special Variable, *rpc-functions*: Private special variables
Special Variable, *rpc-path*: Private special variables
Special Variable, *scroll-disabled*: Private special variables
Special Variable, *serv*: Private special variables
Special Variable, *session-list*: Private special variables
Special Variable, *ssl-cert*: Private special variables
Special Variable, *ssl-key*: Private special variables
Special Variable, *style-cache*: Private special variables
Special Variable, *takit-path*: Private special variables
Special Variable, *takit-wait-list*: Private special variables
Special Variable, *use-wss*: Private special variables
Special Variable, *ws-path*: Private special variables
Special Variable, *youtube-js-loaded*: Private special variables

W
wait-list: Private classes

Jump to:   *  
C   S   W