Example #1
0
        /// <summary>
        /// Gets the loaded module corresponding to the HTML element if it has been loaded
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public static Module GetModule(Element element)
        {
            for (int i = 0; i < Instances.Count; ++i)
            {
                ModuleInstance instance = (ModuleInstance)Instances[i];

                if (instance.Element == element)
                {
                    return(instance.Instance);
                }
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// When a DOM element needs to be updated with new HTML, the existing module associated with the element is unloaded
        /// </summary>
        public virtual void Unload()
        {
            /// Currently, we search through all loaded modules and find the one matching the current module and remove it
            for (int i = 0; i < Instances.Count; ++i)
            {
                ModuleInstance instance = (ModuleInstance)Instances[i];

                if (instance.Element == this.Element)
                {
                    Instances.Remove(instance);
                    return;
                }
            }
        }