The Tab Manager
The Tab Manager is responsible for creating tabs and is the primary interface for modifying them. It also maintains a list of all tabs in the application across all windows.
There is only one tab manager and it can always be found at jancy.tabManager
.
Methods
tabManager.getAllTabs()
Returns an array of all tab objects.
tabManager.getRelatedTabs(partionId)
partitionId
(string
)
Returns an array of all tab objects that belong to the same partition.
tabManager.getTab(search)
search
(Object
)uuid
(string
)
Returns a tab object that matches uuid
otherwise null
.
const tab = jancy.tabManager.getTab({ uuid: "75442486-0878-440c-9db1-a7006c25a39f" })
tabManager.navigateTab(tab, arg)
tab
(Tab object
|string
)arg
(Object
)mode
(string
) required can beback
,forward
,home
,url
,reload
,stop
, orstop-or-reload
url
(string
) optional the URL to navigate to ifmode
isurl
hard
(boolean
) optional perform a hard reload ifmode
isreload
orstop-or-reload
tab
can either be a Tab object
or an ID of a tab represented as a string
.
Causes the tab to start navigating, or stops a current navigation, or reload a tab.
const tab = jancy.tabManager.getTab({ uuid: "75442486-0878-440c-9db1-a7006c25a39f" }) jancy.tabManager.navigateTab(tab, { mode: 'url', url: 'www.ticketmaster.com' })
Since Jancy 1.9.2, this method is also callable via an
action
.const tab = window.jancyAPI.getTabInfo() window.jancyAPI.dispatchAction( 'tab-manager:call', { method: 'navigateTab', args: [ tab.uuid, { mode: 'url', url: 'www.ticketmaster.com' } ] } )
tabManager.updateTab(tab, arg, force=false)
tab
(Tab object
)arg
(Tab Update object
)force
(boolean
)
We use this method that takes one or more changes in the form of a tab update object called arg
to properly update the given tab object and broadcast changes back to interested parties.
In an attempt to minimize notification chatter, properties in arg
are compared against the current corresponding value on the tab. Updates are only applied when there is a difference. Setting force
to true
overrides this behavior.
const tab = jancy.tabManager.getTab({ uuid: "75442486-0878-440c-9db1-a7006c25a39f" }) const updates = { priority: 1, subTitle: 'New subtitle' } jancy.tabManager.updateTab(tab, updates)
Events
The following events are emitted by the tab manager.
tab-added
Emitted when a tab has been added to the manager.
tab
(Tab object
)
tab-nav-back
Emitted when a tab has navigated backwards in their history.
tab
(Tab object
)
tab-nav-forward
Emitted when a tab has navigated forwards in their history.
tab
(Tab object
)
tab-reload
Emitted when a tab has reloaded.
object
tab
(Tab object
)hard
(boolean
)delay
(number
)
tab-removed
Emitted when a tab has been removed for good from the manager.
tab
(Tab object
)
tab-reopened
Emitted when a tab has been reopened.
tab
(Tab object
)
tab-soft-removed
Emitted when a tab has been closed but is still eligible to be restored.
tab
(Tab object
)