Skip to content

Source

Defined in: core/source/source.ts:62

A Source represents an object of an Item that is used on the stage. Manipulating Source specific properties would render changes to all items linked to that source.

var xjs = require('xjs');
var Scene = xjs.Scene
xjs.ready()
.then(Scene.getById(1))
.then(function(scene) {
scene.getSources().then(function(sources) {
return sources[0].setCustomName('Custom Name');
})
})

All methods marked as Chainable resolve with the original Source instance. This allows you to perform sequential operations correctly: *

var xjs = require('xjs');
var Source = xjs.Source;
xjs.ready()
.then(Source.getCurrentSource)
.then(function(source){
//Manipulate source here
return source.setName('New Name');
}).then(function(source){
return source.setKeepLoaded(true)
}).then(function(source){
// set more source properties here
})
  • ISource

new Source(props?): Source

Defined in: core/source/source.ts:75

Source

getCustomName: () => Promise<string>

Defined in: core/source/source.ts:291

See: #core/ISource#getCustomName getCustomName

Promise<string>

ISource.getCustomName


getId: () => Promise<string>

Defined in: core/source/source.ts:316

See: #core/ISource#getId getId

Promise<string>

ISource.getId


getItemList: () => Promise<Item[]>

Defined in: core/source/source.ts:321

See: #core/ISource#getItemList getItemList

Promise<Item[]>

ISource.getItemList


getKeepLoaded: () => Promise<boolean>

Defined in: core/source/source.ts:306

See: #core/ISource#getKeepLoaded getKeepLoaded

Promise<boolean>

ISource.getKeepLoaded


getName: () => Promise<string>

Defined in: core/source/source.ts:281

See: #core/ISource#getName getName

Promise<string>

ISource.getName


getType: () => Promise<ItemTypes>

Defined in: core/source/source.ts:331

See: #core/ISource#getType getType

Promise<ItemTypes>

ISource.getType


getValue: () => Promise<string | XML>

Defined in: core/source/source.ts:296

See: #core/ISource#getValue getValue

Promise<string | XML>

ISource.getValue


refresh: () => Promise<Source>

Defined in: core/source/source.ts:326

See: #core/ISource#refresh refresh

Promise<Source>

ISource.refresh


setCustomName: () => Promise<Source>

Defined in: core/source/source.ts:286

See: #core/ISource#setCustomName setCustomName

Promise<Source>

ISource.setCustomName


setKeepLoaded: (value) => Promise<Source>

Defined in: core/source/source.ts:311

See: #core/ISource#setKeepLoaded setKeepLoaded

boolean

Promise<Source>

ISource.setKeepLoaded


setName: (value) => Promise<Source>

Defined in: core/source/source.ts:276

See: #core/ISource#setName setName

string

Promise<Source>

ISource.setName


setValue: (value) => Promise<Source>

Defined in: core/source/source.ts:301

See: #core/ISource#setValue setValue

string | XML

Promise<Source>

ISource.setValue

static getAllSources(): Promise<Source[]>

Defined in: core/source/source.ts:220

return: Promise<Source[]>

Get all unique Source from every scene. Total number of Sources returned may be less than total number of items on all the scenes due to Linked items only having a single Source.

xjs.Source.getAllSources().then(function(sources) {
for(var i = 0 ; i < sources.length ; i++) {
if(sources[i] instanceof xjs.HtmlSource) {
// Manipulate HTML Source here
}
}
})

Promise<Source[]>


static getCurrentSource(): Promise<Source>

Defined in: core/source/source.ts:108

return: Promise

Get the current source (when function is called by sources), or the source that was right-clicked to open the source properties window (when function is called from the source properties window)

xjs.Source.getCurrentSource().then(function(source) {
// This will fetch the current source (the plugin)
}).catch(function(err) {
// Handle the error here. Errors would only occur
// if we try to execute this method on Extension plugins
});

Promise<Source>


static getItemList(): Promise<Item[]>

Defined in: core/source/source.ts:167

return: Promise<Item[]>

Get the item List of the current Source. The item list is a list of items linked to a single Source.

xjs.Source.getItemList()
.then(function(items) {
// This will fetch the item list of the current Source
for (var i = 0 ; i < items.length ; i++) {
// Manipulate each item here
}
});

This is just the shorter way of getting items that are linked to a single source. See the long version below:

xjs.Source.getCurrentSource()
.then(source.getItemList)
.then(function(items) {
// Manipulate the items here
})

Promise<Item[]>