Index

index

MMO · 36 symbols · generated 30 Sep 2026

constant

$

mmo.js:27

Make sure node is a dom element.

MMO.$ = MMO.core.dom.$;
Namespace
MMO
Convert string into a dom element (querySelector)
function

domReady

mmo.js:35

Run a function once the dom is ready, immediately if it already is.

function MMO.domReady(fn)
Namespace
MMO
fnFunction
returnsPromise
function

define

mmo.js:46

Define a Custom Element

function MMO.define(tagName, classElement, extend)
Namespace
MMO
tagNamestring
classElementstring
extendstringthe htmlelement class parent (ex: div)
returnsvoid
function

provide

mmo.js:78

Declare a namespace, creating every missing level of it.

function MMO.provide(name, value = null)
Namespace
MMO
This is also the declaration the bundler reads: a `MMO.provide('MMO.x.y');` at the top of a source file tells `MMO\client\JSCompiler` that the file defines `MMO.x.y`, which is what it sorts the files on. Those one-argument calls never run -- the compiler strips them and emits the whole namespace bootstrap at the top of the bundle instead. The function is what remains for code that creates a namespace dynamically, and for loading the raw sources unbundled.
namestringMUST be MMO.xxxx
value = nullobject[opt] the value to set at the last level; a namespace is created without it
returns!Objectthe namespace
function

require

mmo.js:102

Declare that this file needs a namespace another one provides.

function MMO.require(name)
Namespace
MMO
Like `MMO.provide`, this is read by the bundler -- it is the edge of the dependency graph it sorts on -- and stripped from the bundle, where the sort has already made it true.
namestring
returns?Objectthe namespace, or null when nothing provides it
function

reloadJS

mmo.js:119

Reload the library's <script> tags in place, cache-busted. A development helper: it re-evaluates the scripts without reloading the page, so the dom state survives.

function MMO.reloadJS(urlContains = 'client.js')
Namespace
MMO
urlContains = 'client.js'stringonly reload the scripts whose src contains this; '' means all
function

askBeforeLeaving

mmo.js:136

Prevent leaving page without confirming

function MMO.askBeforeLeaving(add = true)
Namespace
MMO
add = true
function

sleep

mmo.js:156
function MMO.sleep(timeoutInMs = 300)
Namespace
MMO
timeoutInMs = 300number
returnsPromise<void>resolved after that delay
function

screenshot

asyncmmo.js:171

Capture the current tab as an image.

async function MMO.screenshot(quality = 0.7, type = "image/jpeg")
Namespace
MMO
NOTE: this goes through `getDisplayMedia`, so the browser ASKS the user to pick what to share. It cannot run unattended, and it resolves to undefined when unsupported.
quality = 0.7number0..1, for the lossy formats
type = "image/jpeg"stringthe image mime type
returnsPromise<string | undefined>a data url
function

url

mmo.js:235

Replace paths placeholder {xxx} in an url. ex: myurl/{username}/{date} The returned url is based on the siteurl path set in MMO.config.paths.

function MMO.url(url, base = 'siteurl', data = null)
Namespace
MMO
NOTE: `siteurl` is the base url for the apache server, whereas `baseurl` is the real url for the server files. WARNING: url defines that if the ending of an url is not '/', it will use its dirname instead of the full url. DO NOT forget the ending '/' in a custom url. Look in the browser console to know which paths are registered in `MMO.config.paths`
urlstring
base = 'siteurl'?stringthe base used to construct the url. it can be a registered path in the config or an absolute url or undefined.
data = nullnull | object | Mapif given, will replace some placeholders with these data
returnsstring
function

fileUrl

mmo.js:277

Same as MMO.url, except the base of the url is set to baseurl (which is the real url for files) instead of siteurl

function MMO.fileUrl(url, data = null)
Namespace
MMO
url
data = null
function

path

mmo.js:286

Get a path from the config (used by MMO.url)

function MMO.path(name)
Namespace
MMO
name
returns*
function

pathExists

mmo.js:294
function MMO.pathExists(name)
Namespace
MMO
namestring
returnsbooleantrue when the server registered a path under this name
function

fetch

mmo.js:307

Fetch a request async

function MMO.fetch(url, options = null)
Namespace
MMO
urlstring | Requestthe url to query or a Request Object
options = nullnull | objectthe options for fetch
returnsPromisethe response as value
function

fetchJSON

mmo.js:322

Fetch a request's json response async

function MMO.fetchJSON(url, options = null)
Namespace
MMO
urlstring | Requestthe url to query or a Request Object
options = nullnull | objectthe options for fetch
returnsPromisethe json response as value
function

fetchAPI

mmo.js:342
Fetch a request's json response async formatted by the mmoframework (with logs and links) > Note: if a schema's link is provided, the schema is fetched and added to the response > Note: data are automatically converted to MMO.element.Entity and all the references inside the data (`$ref`) are resolved too.function MMO.fetchAPI(url, options = null)
Namespace
MMO
> Note: if `logs` is part of the response, the logs are added to the app with `MMO.app.console.addLog`
urlstring | Requestthe url to query or a Request Object
options = nullnull | objectthe options for fetch
returnsPromisethe json response as value {data: [MMO.elements.Entity], links: {rel: Link}, schema: ?MMO.schemas.Schema, logs: [Log]}
function

loadJSON

asyncmmo.js:357
Turn a raw framework API response into usable objects, in place: - `links` are parsed into objects - `logs` are pushed to the app console - the linked `schema` is fetched - `data` become MMO.elements.Entity, and the `$ref` between them are resolved into real object references, so the same entity appearing twice IS the same objectasync function MMO.loadJSON(json, url = null)
Namespace
MMO
jsonObjectthe parsed response, MODIFIED in place
url = null?stringthe url it came from, for the logs
returnsPromise<Object>the same object
function

fetchText

mmo.js:427

Fetch a request's text response async

function MMO.fetchText(url, options = null)
Namespace
MMO
urlstring | Requestthe url to query or a Request Object
options = nullnull | objectthe options for fetch
returnsPromisethe text response as value
function

fetchXml

mmo.js:443

Fetch and parse an xml document.

function MMO.fetchXml(url, options = null)
Namespace
MMO
urlstring | Request
options = null?Objectoptions for fetch
returnsPromise<Document>
function

fetchSvg

mmo.js:456

Fetch and parse an svg document.

function MMO.fetchSvg(url, options = null)
Namespace
MMO
urlstring | Request
options = null?Objectoptions for fetch
returnsPromise<Document>
function

fetchFile

mmo.js:471

Fetch a request's file response async (as blob) and open a window with the data.

function MMO.fetchFile(url, options = null, filename = null)
Namespace
MMO
This function is used to get a file from the server and open it in a new window
urlstring | Requestthe url to query or a Request Object
options = nullnull | objectthe options for fetch
filename = nullnull | stringthe filename to use for the download
returnsPromisethe response blob as value
function

sendMail

mmo.js:508

Ask the server's mail controller to send a templated mail.

function MMO.sendMail(email, subject, data, template)
Namespace
MMO
emailstringthe recipient
subjectstring
dataObjectthe values injected into the template
templatestringthe server side template's name
returnsPromise<Response>
throwsMMO.Errorwhen the server registered no mail path
function

download

mmo.js:522

Trigger a download

function MMO.download(filename, data)
Namespace
MMO
filename
data
function

copyToClipboard

mmo.js:540

Copy text content to clipboard

function MMO.copyToClipboard(text)
Namespace
MMO
text
returns
function

print

mmo.js:549

Print given nodes in a new window

function MMO.print(title, ...nodes)
Namespace
MMO
title
...nodes
function

error

mmo.js:595

In order to not mess up the correct line and number of the logs in the console, you need to return a function bound to the console: https://stackoverflow.com/questions/9559725/extending-console-log-without-affecting-log-line/26078207#26078207

function MMO.error()
Namespace
MMO
function

warning

mmo.js:603

Log a warning, tagged and colored, keeping the CALLER's file and line in the console.

function MMO.warning()
Namespace
MMO
function

info

mmo.js:611

Log an informative message, tagged and colored.

function MMO.info()
Namespace
MMO
function

debug

mmo.js:619

Log a debug message, tagged but discreet.

function MMO.debug()
Namespace
MMO
function

scriptError

mmo.js:630

Log an error that happen in an inline script

function MMO.scriptError(message, e, script)
Namespace
MMO
messagestringthe message
eErrorthe error thrown by the script
scripttextthe script's text
returnsnone
constant

uniqueID

mmo.js:643

Unique ids for object so you can test if two objects are the same (same ids)

MMO.uniqueID = 0;
Namespace
MMO
function

uniqueObjectID

mmo.js:650

Get a stable numeric id for an object, assigning one on first use.

function MMO.uniqueObjectID(object)
Namespace
MMO
objectObject
returnsnumber
function

onDateInput

mmo.js:665

Browser fix: a date input silently clears itself when the user types a partial value.

function MMO.onDateInput(event)
Namespace
MMO
This remembers the last complete value and puts it back.
eventEvent
function

addCharactersLeft

mmo.js:680

Add a live "N characters left" counter under every [maxlength] input of a subtree.

function MMO.addCharactersLeft(node = null)
Namespace
MMO
Calling it twice on the same input is safe.
node = null?Nodedefaults to the whole document
constant

window

mmo.js:699
MMO.window = new MMO.core.Window(window);
Namespace
MMO
function

insertText

mmo.js:727

Insert text in an element

function MMO.insertText(element, text)
Namespace
MMO
element
text