New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bsc-plugin-auto-findnode

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bsc-plugin-auto-findnode

A BrighterScript plugin that auto-injects `m.top.findNode()` calls in your component `init()` functions

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
21
increased by40%
Maintainers
0
Weekly downloads
 
Created
Source

bsc-plugin-auto-findnode

A BrighterScript plugin that auto-injects m.top.findNode() calls in your component init() functions

build status coverage status monthly downloads npm version license Slack

Installation

  1. Install the package via npm:
npm install bsc-plugin-auto-findnode
  1. Add the plugin to your bsconfig.json
{
    "plugins": [
        "bsc-plugin-auto-findnode"
    ]
}
  1. Run brighterscript like normal, and the plugin will work!
npx bsc

How it works

  1. find every xml file in the project
  2. find every element with an ID in that xml file
  3. find the init() function for each scope (or create one in a new file)
  4. inject m.<elementId> = m.top.findNode("<elementId>") into the init function

For example:

Before:

pkg:/components/ZombieKeyboard.xml

<component name="ZombieKeyboard">
    <children>
        <label id="helloZombieText" />
    </children>
    <script uri="ZombieKeyboard.brs" />
</component>

pkg:/components/ZombieKeyboard.brs

sub init()
    print "init for the keyboard!"
end sub

After:

pkg:/components/ZombieKeyboard.xml

<component name="ZombieKeyboard">
    <children>
        <label id="helloZombieText" />
    </children>
    <script uri="ZombieKeyboard.brs" />
</component>

pkg:/components/ZombieKeyboard.brs

sub init()
    m.helloZombieText = m.top.findNode("helloZombieText")
    print "init for the keyboard!"
end sub

FAQs

Package last updated on 09 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc