MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

index

MMO · 42 symboles · générée le 27 Oct 2026

constant

$

mmo.js:27

Make sure node is a dom element.

MMO.$ = MMO.core.dom.$;
Espace de noms
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)
Espace de noms
MMO
fnFunction
retournePromise
function

define

mmo.js:46

Define a Custom Element

function MMO.define(tagName, classElement, extend)
Espace de noms
MMO
tagNamestring
classElementstring
extendstringthe htmlelement class parent (ex: div)
retournevoid
function

provide

mmo.js:78

Declare a namespace, creating every missing level of it.

function MMO.provide(name, value = null)
Espace de noms
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
retourne!Objectthe namespace
function

require

mmo.js:102

Declare that this file needs a namespace another one provides.

function MMO.require(name)
Espace de noms
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
retourne?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')
Espace de noms
MMO
urlContains = 'client.js'stringonly reload the scripts whose src contains this; '' means all
function

askBeforeLeaving

mmo.js:141

Prevent leaving page without confirming

function MMO.askBeforeLeaving(add = true)
Espace de noms
MMO
add = true
MMO.askBeforeLeaving(() => hasUnsavedChanges)MMO.askBeforeLeaving(form); entity.save().then(() => form.changed = false)
function

sleep

mmo.js:181
function MMO.sleep(timeoutInMs = 300)
Espace de noms
MMO
timeoutInMs = 300number
retournePromise<void>resolved after that delay
function

screenshot

asyncmmo.js:196

Capture the current tab as an image.

async function MMO.screenshot(quality = 0.7, type = "image/jpeg")
Espace de noms
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
retournePromise<string | undefined>a data url
function

url

mmo.js:260

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)
Espace de noms
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
retournestring
function

fileUrl

mmo.js:303

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)
Espace de noms
MMO
url
data = null
function

path

mmo.js:312

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

function MMO.path(name)
Espace de noms
MMO
name
retourne*
function

pathExists

mmo.js:320
function MMO.pathExists(name)
Espace de noms
MMO
namestring
retournebooleantrue when the server registered a path under this name
function

fetch

mmo.js:333

Fetch a request async

function MMO.fetch(url, options = null)
Espace de noms
MMO
urlstring | Requestthe url to query or a Request Object
options = nullnull | objectthe options for fetch
retournePromisethe response as value
constant

pendingLogs

mmo.js:348
MMO.pendingLogs = [];
Espace de noms
MMO
constant

pendingLogsLimit

mmo.js:354
MMO.pendingLogsLimit = 100;
Espace de noms
MMO
function

addLogs

mmo.js:364

Add a response's server logs to the application's console, or keep them until it exists.

function MMO.addLogs(logs, group = null)
Espace de noms
MMO
It never throws: a response's logs must not cost the page its data.
logsArraythe logs of a framework response
group = null?(string | Request)what they came from, the console's group
retournevoid
MMO.addLogs(json.logs, url)
function

flushLogs

mmo.js:383

Hand the logs kept by MMO.addLogs to a console, which <mmo-app> does once loaded.

function MMO.flushLogs(target = MMO.app?.console)
Espace de noms
MMO
target = MMO.app?.console?Objectthe console (<mmo-console>); none drops them
retournevoid
MMO.flushLogs(MMO.app.console)
function

connectConsole

mmo.js:398

Give a console the page's own logs, then the ones MMO.addLogs kept, as soon as it can take them.

function MMO.connectConsole(target, logs = null)
Espace de noms
MMO
`<mmo-app>` can be upgraded before `<mmo-console>` is defined (#251): until then its console is a plain element without `addLogs`, and the logs wait in MMO.pendingLogs, the page's first. It never throws.
target?HTMLElementthe console (<mmo-console>); none drops them, like MMO.flushLogs
logs = null?Arraythe page's own logs (MMO.config.logs)
retournePromiseresolved once the logs are in the console
MMO.connectConsole(this.console, config.logs)
function

showError

mmo.js:416

Show an error in the application's dialog, or in the browser's console while there is no application yet: a request failing before the dom is ready must keep its own error, not raise another one.

function MMO.showError(title, ...content)
Espace de noms
MMO
titlestring | Error
...content...*
retournevoid
MMO.showError(MMO.i18n.$('Server error'), e)
function

fetchJSON

mmo.js:427

Fetch a request's json response async

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

fetchAPI

mmo.js:447
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)
Espace de noms
MMO
> Note: if `logs` is part of the response, the logs are added to the app's console (`MMO.addLogs`)
urlstring | Requestthe url to query or a Request Object
options = nullnull | objectthe options for fetch
retournePromisethe json response as value {data: [MMO.elements.Entity], links: {rel: Link}, schema: ?MMO.schemas.Schema, logs: [Log]}
function

loadJSON

asyncmmo.js:462
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)
Espace de noms
MMO
jsonObjectthe parsed response, MODIFIED in place
url = null?stringthe url it came from, for the logs
retournePromise<Object>the same object
function

fetchText

mmo.js:532

Fetch a request's text response async

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

fetchXml

mmo.js:548

Fetch and parse an xml document.

function MMO.fetchXml(url, options = null)
Espace de noms
MMO
urlstring | Request
options = null?Objectoptions for fetch
retournePromise<Document>
function

fetchSvg

mmo.js:561

Fetch and parse an svg document.

function MMO.fetchSvg(url, options = null)
Espace de noms
MMO
urlstring | Request
options = null?Objectoptions for fetch
retournePromise<Document>
function

fetchFile

mmo.js:576

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

function MMO.fetchFile(url, options = null, filename = null)
Espace de noms
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
retournePromisethe response blob as value
function

sendMail

mmo.js:613

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

function MMO.sendMail(email, subject, data, template)
Espace de noms
MMO
emailstringthe recipient
subjectstring
dataObjectthe values injected into the template
templatestringthe server side template's name
retournePromise<Response>
lèveMMO.Errorwhen the server registered no mail path
function

download

mmo.js:627

Trigger a download

function MMO.download(filename, data)
Espace de noms
MMO
filename
data
function

copyToClipboard

mmo.js:645

Copy text content to clipboard

function MMO.copyToClipboard(text)
Espace de noms
MMO
text
retourne
function

print

mmo.js:654

Print given nodes in a new window

function MMO.print(title, ...nodes)
Espace de noms
MMO
title
...nodes
function

error

mmo.js:710

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()
Espace de noms
MMO
function

warning

mmo.js:718

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

function MMO.warning()
Espace de noms
MMO
function

info

mmo.js:726

Log an informative message, tagged and colored.

function MMO.info()
Espace de noms
MMO
function

debug

mmo.js:734

Log a debug message, tagged but discreet.

function MMO.debug()
Espace de noms
MMO
function

scriptError

mmo.js:745

Log an error that happen in an inline script

function MMO.scriptError(message, e, script)
Espace de noms
MMO
messagestringthe message
eErrorthe error thrown by the script
scripttextthe script's text
retournenone
constant

uniqueID

mmo.js:758

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

MMO.uniqueID = 0;
Espace de noms
MMO
function

uniqueObjectID

mmo.js:765

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

function MMO.uniqueObjectID(object)
Espace de noms
MMO
objectObject
retournenumber
function

onDateInput

mmo.js:780

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

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

addCharactersLeft

mmo.js:795

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

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

window

mmo.js:818
MMO.window = new MMO.core.Window(window);
Espace de noms
MMO
function

insertText

mmo.js:846

Insert text in an element

function MMO.insertText(element, text)
Espace de noms
MMO
element
text