How to use the @glimmer/runtime/dist/modules/es2017/lib/environment.inTransaction function in @glimmer/runtime

To help you get started, we’ve selected a few @glimmer/runtime 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 bakerac4 / glimmer-native / dist / src / dom / native / ListViewElement.js View on Github external
if (!args.view || !args.view.__GlimmerComponent__) {
                let template;
                if (args.view && args.view.__GlimmerComponentBuilder__) {
                    console.info(`instantiating component in keyed view item ${args.view.__GlimmerNativeElement__.id} for item index ${args.index}`);
                    args.view.__GlimmerComponentBuilder__(item);
                    args.view.__GlimmerComponentBuilder__ = null; // free the memory
                    return;
                }
                template = listView.itemTemplates.filter((x) => x.key == 'default')[0];
                if (!template) {
                    console.info(`Counldn't determine component to use for item at ${args.index}`);
                    return;
                }
                let wrapper = createElement('StackLayout');
                wrapper.setAttribute('id', `default-${this.numberViewsCreated}`);
                inTransaction(Application.aotRuntime.env, () => {
                    renderItem(wrapper, { compiled: template.component, args: template.args }, item);
                });
                args.view = wrapper.nativeView;
            }
            else {
                inTransaction(Application.aotRuntime.env, () => {
                    let componentInstance = args.view.__GlimmerComponent__;
                    const oldState = componentInstance.state.value();
                    // Update the state with the new item
                    componentInstance.update(Object.assign(Object.assign({}, oldState), { item }));
                });
            }
        });
    }
github bakerac4 / glimmer-native / src / dom / native / ListViewElement.ts View on Github external
);
                (args.view as any).__GlimmerComponentBuilder__(item);
                (args.view as any).__GlimmerComponentBuilder__ = null; // free the memory
                return;
            }

            template = (listView as any).itemTemplates.filter((x) => x.key == 'default')[0];

            if (!template) {
                console.info(`Counldn't determine component to use for item at ${args.index}`);
                return;
            }

            let wrapper = createElement('StackLayout') as NativeViewElementNode
github bakerac4 / glimmer-native / src / dom / native / ListViewElement.ts View on Github external
template = (listView as any).itemTemplates.filter((x) => x.key == 'default')[0];

            if (!template) {
                console.info(`Counldn't determine component to use for item at ${args.index}`);
                return;
            }

            let wrapper = createElement('StackLayout') as NativeViewElementNode
github bakerac4 / glimmer-native / dist / index.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
            try {
                inTransaction(Application.aotRuntime.env, () => {
                    Application.result.rerender();
                    Application._rendered = true;
                });
                console.log('Result Re-rendered');
            }
            catch (error) {
                console.log(`Error in re-render: ${error}`);
            }
        });
    }