예제 #1
0
        /// <summary>
        /// Marks the <see cref="ScriptObject"/> for observation and property monitoring.
        /// </summary>
        public void Observe()
        {
            // If it's already observed, do not do anything
            if (this.Flags.HasFlag(ScriptObjectFlag.Observe))
                return;

            // Mark the object as observed
            this.Flags |= ScriptObjectFlag.Observe;

            // Put the key as the $i property
            this.Put("$i", this.Key);

            // Invoke observed event
            if (ScriptObject.Observed != null)
                ScriptObject.Observed(this);

            // Observe it as an associative array or as an object
            this.ObserveChildren();
        }
예제 #2
0
        /// <summary>
        /// Marks the observed <see cref="ScriptObject"/> and property monitoring.
        /// </summary>
        public void Ignore()
        {
            // If it's not observed, do not do anything
            if (!this.Flags.HasFlag(ScriptObjectFlag.Observe))
                return;

            // Unmark the object as observed
            this.Flags &= ~ScriptObjectFlag.Observe;

            // Invoke ignored event
            if (ScriptObject.Ignored != null)
                ScriptObject.Ignored(this);

            // Observe it as an associative array or as an object
            this.IgnoreChildren();
        }