| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.sdk; |
| 6 |
| 7 /** |
| 8 * A variable from JavaScript declarative scope. This variable is backed by a pr
operty |
| 9 * of any object, instead it is a variable that has been explicitly declared in
program, |
| 10 * for example with 'var' keyword. |
| 11 * <p>This variable explicitly supports mutation operation. |
| 12 * @see {@link JsScope.Declarative} |
| 13 */ |
| 14 public interface JsDeclarativeVariable extends JsVariable { |
| 15 /** |
| 16 * @return whether it is possible to modify this variable |
| 17 */ |
| 18 boolean isMutable(); |
| 19 |
| 20 /** |
| 21 * Sets a new value for this variable. |
| 22 * |
| 23 * @param newValue to set |
| 24 * @param callback to report the operation result to |
| 25 * @param syncCallback to report the end of any processing |
| 26 * @see #isMutable() |
| 27 * @throws UnsupportedOperationException if this variable is not mutable |
| 28 */ |
| 29 RelayOk setValue(JsValue newValue, SetValueCallback callback, SyncCallback syn
cCallback) |
| 30 throws UnsupportedOperationException; |
| 31 |
| 32 /** |
| 33 * A callback to use while setting a variable value. |
| 34 */ |
| 35 interface SetValueCallback { |
| 36 /** |
| 37 * Variable is successfully updated. New value is available in {@link JsVari
able#getValue()}. |
| 38 */ |
| 39 void success(); |
| 40 |
| 41 /** |
| 42 * Variable hasn't been updated for unknown reason. |
| 43 */ |
| 44 void failure(Exception cause); |
| 45 } |
| 46 } |
| OLD | NEW |