How to use the svelte-native/dom.logger.debug function in svelte-native

To help you get started, we’ve selected a few svelte-native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github halfnelson / svelte-native-nativescript-ui / src / listview / index.ts View on Github external
let _view = view as any;
        if (!_view.__SvelteComponent__) {
            if (_view.__SvelteComponentBuilder__) {
                logger.debug("mounting to view "+view+" with props "+Object.keys(props).join(","));
                _view.__SvelteComponentBuilder__(props);
                _view.__SvelteComponentBuilder__ = null;
                return;
            }
        }

        if (_view.__SvelteComponent__) {
            componentInstance = _view.__SvelteComponent__
        }
    
        if (componentInstance) {
            logger.debug("updating view "+view+" with props "+Object.keys(props).join(","));
            componentInstance.$set(props)
        } else {
            console.error("Couldn't find component for ", view);
        }
    }
github halfnelson / svelte-native-nativescript-ui / src / listview / index.ts View on Github external
private updateViewWithProps(view: View, props: any) {
        let componentInstance:SvelteComponent;
        let _view = view as any;
        if (!_view.__SvelteComponent__) {
            if (_view.__SvelteComponentBuilder__) {
                logger.debug("mounting to view "+view+" with props "+Object.keys(props).join(","));
                _view.__SvelteComponentBuilder__(props);
                _view.__SvelteComponentBuilder__ = null;
                return;
            }
        }

        if (_view.__SvelteComponent__) {
            componentInstance = _view.__SvelteComponent__
        }
    
        if (componentInstance) {
            logger.debug("updating view "+view+" with props "+Object.keys(props).join(","));
            componentInstance.$set(props)
        } else {
            console.error("Couldn't find component for ", view);
        }
github halfnelson / svelte-native-nativescript-ui / src / autocomplete / index.ts View on Github external
private loadView(viewType: string): View {
        if (viewType != AutoCompleteViewType.ItemView)
            return null;
        
        let suggestionView = this.nativeView.suggestionView
        if (!suggestionView || !suggestionView.__SvelteNativeElement__) return;

        let componentClass = (suggestionView.__SvelteNativeElement__ as SuggestionViewElement).itemTemplateComponent;
        if (!componentClass) return null;

        logger.debug("creating view for " + viewType);

        let wrapper = createElement('StackLayout') as NativeViewElementNode
github halfnelson / svelte-native-nativescript-ui / src / listview / index.ts View on Github external
onInsertedChild(childNode: ViewNode, index: number) {
        super.onInsertedChild(childNode, index);
        if (childNode instanceof TemplateElement) {
            let type = childNode.getAttribute('type') || ListViewViewType.ItemView
            if (type.toLowerCase() != ListViewViewType.ItemView.toLowerCase()) return;

            let key = childNode.getAttribute('key') || "default"
            logger.debug(`Adding template for key ${key}`);
            if (!this.nativeView.itemTemplates || typeof this.nativeView.itemTemplates == "string") {
                this.nativeView.itemTemplates = []
            }
            this.nativeView.itemTemplates = this.nativeView.itemTemplates.concat(new SvelteKeyedTemplate(key, childNode))
        }
    }
github halfnelson / svelte-native-nativescript-ui / src / autocomplete / index.ts View on Github external
private updateListItem(args: AutocompleteItemEventData) {
        let componentInstance:SvelteComponent;
        let view = args.view as any;

        //if we are a svelte component, update our props
        if (!view) return;

        if (!view.__SvelteComponent__) {
            if (view.__SvelteComponentBuilder__) {
                logger.debug("mounting to view "+view+" with props "+Object.keys(args.data).join(","));
                view.__SvelteComponentBuilder__({ item: args.data });
                view.__SvelteComponentBuilder__ = null;
                return;
            }
        }

        if (view.__SvelteComponent__) {
            componentInstance = view.__SvelteComponent__
        }
    
        if (componentInstance) {
            logger.debug("updating view "+view+" with props "+Object.keys(args.data).join(","));
            componentInstance.$set({ item: args.data })
        } 
    }
github halfnelson / svelte-native-nativescript-ui / src / listview / index.ts View on Github external
private loadView(viewType: string): View {
        if (viewType.toLowerCase() == ListViewViewType.ItemView.toLowerCase() && typeof this.nativeElement.itemTemplates == "object" ) {
            let keyedTemplate = this.nativeElement.itemTemplates.find(t => t.key == "default");
            if (keyedTemplate) {
                return keyedTemplate.createView()
            }
        }

        let componentClass = this.getComponentForView(viewType);
        if (!componentClass) return null;
        logger.debug("creating view for " + viewType);

        let wrapper = createElement('StackLayout') as NativeViewElementNode
github halfnelson / svelte-native-nativescript-ui / src / autocomplete / index.ts View on Github external
if (!view.__SvelteComponent__) {
            if (view.__SvelteComponentBuilder__) {
                logger.debug("mounting to view "+view+" with props "+Object.keys(args.data).join(","));
                view.__SvelteComponentBuilder__({ item: args.data });
                view.__SvelteComponentBuilder__ = null;
                return;
            }
        }

        if (view.__SvelteComponent__) {
            componentInstance = view.__SvelteComponent__
        }
    
        if (componentInstance) {
            logger.debug("updating view "+view+" with props "+Object.keys(args.data).join(","));
            componentInstance.$set({ item: args.data })
        } 
    }