Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(8.2-alpha): Addition of "global" context for expressions inside XML #9734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

CatchABus
Copy link
Contributor

@CatchABus CatchABus commented Jan 8, 2022

PR Checklist

This is an addition to my work for vanilla NS expression parsing. It contains few tweaks regarding binding contexts.

What is the current behavior?

  1. Expression parser cannot parse indentifiers that belong to global.
  2. Converter callbacks use object they are declared into as a context.

What is the new behavior?

  1. Expression parser will now check if an identifier belongs to global.
  2. Converter callbacks will have current binding context or the instance they were called from as function context just like the old way.

Hello World app sample with an example of supporting global:

<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
   <ActionBar title="My App" icon="" />

    <StackLayout class="p-20">
        <Label text="Tap the button" class="h1 text-center" />
        <Button text="TAP" tap="{{ onTap }}" class="-primary" />
        <Label text="{{ message }}" class="h2 text-center" textWrap="true" />
        <!-- Use of `Math` here -->
        <Label text="{{ Math.abs(_counter * -1) }}" class="h2 text-center" textWrap="true" />
    </StackLayout>
</Page>

@cla-bot cla-bot bot added the cla: yes label Jan 8, 2022
@CatchABus CatchABus changed the title Xml expression fixes feat: Addition of "global" context inside XML Jan 8, 2022
@CatchABus CatchABus changed the title feat: Addition of "global" context inside XML feat: Addition of "global" context for expressions inside XML Jan 8, 2022
@CatchABus CatchABus changed the title feat: Addition of "global" context for expressions inside XML feat(8.2-alpha): Addition of "global" context for expressions inside XML Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants