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

Action

MMO.core.history · 1 symbole · générée le 27 Oct 2026

class

Action

history.js:6
class MMO.core.history.Action
Espace de noms
MMO.core.history

Index

constructor(target, doFn, undoFn, state)Create a new action
execute()Run the action, remembering what doFn returned so undo can restore it.
undo()Roll the action back.

Méthodes3

constructor(target, doFn, undoFn, state)

history.js:15

Create a new action

constructor(target, doFn, undoFn, state)
targetObjectthe targeted object
doFnFunctionMUST return an object with the property data. The value is passed to the undo action.
undoFnFunctionCAN return an object with the property data. The value is passed to the do action. if no data is returned, the first state is preserved and used in the do action.
state*a state to pass to the do action

execute()

history.js:28

Run the action, remembering what doFn returned so undo can restore it.

execute()
retournebooleanfalse when the action had already run

undo()

history.js:40

Roll the action back. When undoFn returns a value it becomes the state a later execute replays, otherwise the original state is reused.

undo()
retournebooleanfalse when the action was not in effect