• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mobalazs / rotor-framework / 18919729013

29 Oct 2025 07:21PM UTC coverage: 85.379% (-0.1%) from 85.479%
18919729013

push

github

mobalazs
fix: update debug setting in bsconfig to enable debugging

1781 of 2086 relevant lines covered (85.38%)

1.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.0
/src/source/engine/builder/PluginAdapter.bs
1
namespace Rotor.ViewBuilder
2

3
    ' =====================================================================
4
    ' PluginHookClass - Container for plugin hook metadata and handler function
5
    ' =====================================================================
6
    class PluginHookClass
7

8
        pluginKey as string
9
        handlerFn as function
10

11
        ' ---------------------------------------------------------------------
12
        ' new - Initializes the instance
13
        '
14
        ' @description Initializes plugin hook with key and handler
15
        ' @param {object} config - Configuration with pluginKey and handlerFn
16
        ' ---------------------------------------------------------------------
17
        sub new(config)
18
            m.pluginKey = config.pluginKey
1✔
19
            m.handlerFn = config.handlerFn
1✔
20
        end sub
21

22
    end class
23

24
    ' =====================================================================
25
    ' pluginAdapter - Manages plugin registration and lifecycle hook integration. Maintains plugin instances and maps lifecycle hooks to plugin handlers.
26
    ' =====================================================================
27
    class pluginAdapter
28

29
        plugins as object
30

31
        ' ---------------------------------------------------------------------
32
        ' new - Initializes the instance
33
        '
34
        ' @description Initializes plugin hook storage for all lifecycle types
35
        ' ---------------------------------------------------------------------
36
        sub new()
37

38
            ' dedicated plugin lifecycle hooks
39
            for each hookType in [
1✔
40
                    Rotor.Const.LifeCycleHookType.BEFORE_MOUNT,
41
                    Rotor.Const.LifeCycleHookType.AFTER_MOUNTED,
42
                    Rotor.Const.LifeCycleHookType.BEFORE_UPDATE,
43
                    Rotor.Const.LifeCycleHookType.AFTER_UPDATED,
44
                    Rotor.Const.LifeCycleHookType.BEFORE_DESTROY
45
                ]
46
                m.pluginHooks[hookType] = {}
1✔
47
            end for
48

49
        end sub
50

51
        ' Plugins has limited type of hooks to lifecycle (check the list below)
52
        pluginHooks = {}
53
        pluginKeyList = CreateObject("roList")
54

55
        frameworkInstance as Rotor.Framework
56

57
        ' ---------------------------------------------------------------------
58
        ' registerPlugins - Registers plugins and their lifecycle hooks with the framework
59
        '
60

61
        ' @param {object} pluginConfig - Plugin configuration object or array
62
        ' ---------------------------------------------------------------------
63
        sub registerPlugins (pluginConfig as object)
64

65
            plugins = Rotor.Utils.ensureArray(pluginConfig)
1✔
66

67
            for each plugin in plugins
1✔
68

69
                ' Plugin key
70
                pluginKey = plugin.key
1✔
71

72
                ' add plugin key to tree viewModelState
73
                ' obj = Rotor.Utils.wrapObject(pluginKey, {})
74

75
                ' create workspace for plugin in root of widget tree
76
                ' m.frameworkInstance.builder.widgetTree.tree.extendContext(obj)
77

78
                ' Setup hooks
79
                hooks = plugin.hooks
1✔
80
                if Rotor.Utils.isValid(hooks) and hooks.Count() > 0
3✔
81

82
                    for each hook in hooks
1✔
83
                        pluginHook = new PluginHookClass({
1✔
84
                            pluginKey: pluginKey,
85
                            handlerFn: hooks[hook]
86
                        })
87
                        m.pluginHooks[hook][pluginKey] = pluginHook
1✔
88
                    end for
89

90
                end if
91

92
                ' add plugin instance to viewBuilder
93
                m.pluginKeyList.AddTail(pluginKey)
1✔
94
                m.frameworkInstance.plugins[pluginKey] = plugin
1✔
95
                m.frameworkInstance.plugins[pluginKey].frameworkInstance = m.frameworkInstance
1✔
96
                if Rotor.Utils.isFunction(m.frameworkInstance.plugins[pluginKey].init)
3✔
97
                    m.frameworkInstance.plugins[pluginKey].init()
1✔
98
                end if
99
            end for
100

101
        end sub
102

103
        ' ---------------------------------------------------------------------
104
        ' destroyPlugins - Destroys all registered plugins
105
        ' ---------------------------------------------------------------------
106
        sub destroyPlugins()
107
            if m.plugins.Count() > 0
×
108
                for each plugin in m.plugins
×
109
                    plugin.frameworkInstance = invalid
×
110
                    destroy = plugin.destroy
×
111
                    if Rotor.Utils.isFunction(plugin.destroy)
×
112
                        destroy()
×
113
                    end if
114
                end for
115
            end if
116
        end sub
117

118
        ' ---------------------------------------------------------------------
119
        '
120

121
        ' init - Initializes the adapter with framework instance reference
122
        '
123
        ' @param {object} frameworkInstance - Framework instance reference
124
        ' ---------------------------------------------------------------------
125
        sub init(frameworkInstance as object)
126
            m.frameworkInstance = frameworkInstance
1✔
127
        end sub
128

129
        ' ---------------------------------------------------------------------
130
        ' destroy - Cleans up framework instance reference
131
        '
132
        ' ---------------------------------------------------------------------
133
        sub destroy()
134
            m.frameworkInstance = invalid
1✔
135
        end sub
136

137
    end class
138

139
end namespace
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc