Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 93... Línea 93...
93
        // We store the last transaction into the state.
93
        // We store the last transaction into the state.
94
        const storeTransaction = ({detail}) => {
94
        const storeTransaction = ({detail}) => {
95
            const changes = detail?.changes;
95
            const changes = detail?.changes;
96
            this.dispatch('lastTransaction', name, changes);
96
            this.dispatch('lastTransaction', name, changes);
97
        };
97
        };
98
        instance.target.addEventListener('transaction:start', storeTransaction);
98
        instance.target.addEventListener('transaction:end', storeTransaction);
99
    }
99
    }
Línea 100... Línea 100...
100
 
100
 
101
    /**
101
    /**
102
     * Returns a debugging object for a specific Reactive instance.
102
     * Returns a debugging object for a specific Reactive instance.
Línea 149... Línea 149...
149
 
149
 
150
    /**
150
    /**
151
     * Update the lastChanges attribute with a list of changes
151
     * Update the lastChanges attribute with a list of changes
152
     *
152
     *
153
     * @param {StateManager} stateManager the debug reactive state
153
     * @param {StateManager} stateManager the debug reactive state
154
     * @param {string} name tje instance name
154
     * @param {string} name the instance name
155
     * @param {array} changes the list of changes
155
     * @param {array} changes the list of changes
156
     */
156
     */
157
    lastTransaction(stateManager, name, changes) {
157
    lastTransaction(stateManager, name, changes) {
158
        if (!changes || changes.length === 0) {
158
        if (!changes || changes.length === 0) {
Línea 168... Línea 168...
168
 
168
 
Línea 169... Línea 169...
169
        lastChanges.push('transaction:end');
169
        lastChanges.push('transaction:end');
Línea -... Línea 170...
-
 
170
 
-
 
171
        stateManager.setReadOnly(false);
-
 
172
 
-
 
173
        // Dirty hack to force the lastChanges:updated event to be dispatched.
170
 
174
        state.reactives.get(name).lastChanges = [];
Línea 171... Línea 175...
171
        stateManager.setReadOnly(false);
175
 
172
 
176
        // Assign the actual value.
173
        state.reactives.get(name).lastChanges = lastChanges;
177
        state.reactives.get(name).lastChanges = lastChanges;