|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import { custom_event, append, insert, detach, listen, attr } from './dom';
|
|
|
|
|
import { SvelteComponent } from './Component';
|
|
|
|
|
import { has_Symbol } from './environment';
|
|
|
|
|
|
|
|
|
|
export function dispatch_dev<T=any>(type: string, detail?: T) {
|
|
|
|
|
document.dispatchEvent(custom_event(type, { version: '__VERSION__', ...detail }));
|
|
|
|
@ -82,7 +83,7 @@ export function set_data_dev(text, data) {
|
|
|
|
|
export function validate_each_argument(arg) {
|
|
|
|
|
if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {
|
|
|
|
|
let msg = '{#each} only iterates over array-like objects.';
|
|
|
|
|
if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {
|
|
|
|
|
if (has_Symbol && arg && Symbol.iterator in arg) {
|
|
|
|
|
msg += ' You can use a spread to convert this iterable into an array.';
|
|
|
|
|
}
|
|
|
|
|
throw new Error(msg);
|
|
|
|
|