122 | function callDestroy(context) { |
123 | context.app.emit('componentDestroy', context); |
124 | |
125 | |
126 | const style = document.getElementById(context.uId + '--style'); |
127 | if (style) { |
128 | style.parentNode.removeChild(style); |
129 | } |
130 | |
131 | if (context.store && context.app._stores[context.store]) |
132 | delete context.app._stores[context.store]; |
133 | |
134 | if (context._unmountedPlaceholder && context._unmountedPlaceholder.parentNode) |
135 | context._unmountedPlaceholder.parentNode.removeChild(context._unmountedPlaceholder); |
136 | |
137 | if (context.id && context.app._ids[context.id]) |
138 | delete context.app._ids[context.id]; |
139 | if (typeof context.onDestroy === 'function' && context.parent && typeof context.parent[context.__onDestroy] === 'function') { |
140 | context.onDestroy.call(context); |
141 | context.parent[context.__onDestroy].call(context.parent, context); |
142 | context = null; |
143 | } else if (typeof context.onDestroy === 'function') { |
144 | context.onDestroy.call(context); |
145 | context = null; |
146 | } else if (context.parent && typeof context.parent[context.__onDestroy] === 'function') { |
147 | context.parent[context.__onDestroy].call(context.parent, context); |
148 | context = null; |
149 | } |
150 | |
151 | } |