Class: LevelManager

THING.LevelManager()

LevelManager The level manager.

Constructor

new LevelManager()

The level manager to manage object(s) throught between parent and child object.
Source:

Members

current :THING.BaseObject

Get the current object.
Type:
Source:
Example
let app = THING.App.current;
let level = app.level;
let target = app.query('.Entity')[0];
level.change(target, {
  onComplete: function(){
		let ret = level.current == target;
		// @expect(ret == true);
	 }
});

enable :Boolean

Enable/Disable level manager.
Type:
  • Boolean
Source:
Example
let app = THING.App.current;
let level = app.level;
level.enable = false;
let target = app.query('.Entity')[0];
level.change(target);
let ret = level.isChanging;
// @expect(ret == false);

isChanging :Boolean

Check whether is changing level.
Type:
  • Boolean
Source:
Example
let app = THING.App.current;
let level = app.level;
let target = app.query('.Entity')[0];
level.change(target);
let ret = level.isChanging;
// @expect(ret == true);

prev :THING.BaseObject

Get the previous object.
Type:
Source:
Example
let app = THING.App.current;
let level = app.level;
let prev = level.prev;
let target = app.query('.Entity')[0];
level.change(target, {
  onComplete: function(){
		let ret = level.prev == prev;
		// @expect(ret == true);
	 }
});

Methods

back(options)

Change to the parent level.
Parameters:
Name Type Description
options LevelChangeOptions The options.
Source:
Example
let app = THING.App.current;
let level = app.level;
let target = app.query('.Entity')[0];
level.change(target, {
  onComplete: function(){
		let ret = level.current == target;
		// @expect(ret == true);
		level.back({
  		onComplete: function(){
				ret = level.current == target.parent;
				// @expect(ret == true)
  		}
		});
  }
});

backAsync(options) → {Promise.<any>}

Change to the parent level in async mode.
Parameters:
Name Type Description
options LevelChangeOptions The options.
Source:
Returns:
Type
Promise.<any>
Example
let app = THING.App.current;
let level = app.level;
let target = app.query('.Entity')[0];
level.change(target, {
  onComplete: function(){
		let ret = level.current == target;
		// @expect(ret == true);
		level.backAsync({
  		onComplete: function(){
				ret = level.current == target.parent;
				// @expect(ret == true)
  		}
		});
  }
});

change(object, options)

Change current level.
Parameters:
Name Type Description
object THING.BaseObject The object.
options LevelChangeOptions The options.
Source:
Example
let app = THING.App.current;
let level = app.level;
let target = app.query('.Entity')[0];
level.change(target, {
  onComplete: function(){
		let ret = level.current == target;
		// @expect(ret == true);
  }
});

changeAsync(object, options) → {Promise.<any>}

Change current level in async mode.
Parameters:
Name Type Description
object THING.BaseObject The object.
options LevelChangeOptions The options.
Source:
Returns:
Type
Promise.<any>
Example
let app = THING.App.current;
let level = app.level;
let target = app.query('.Entity')[0];
level.changeAsync(target, {
  onComplete: function(){
		let ret = level.current == target;
		// @expect(ret == true);
  }
});

quit() → {Promise.<any>}

Quit.
Source:
Returns:
Type
Promise.<any>
Example
let app = THING.App.current;
let level = app.level;
level.quit({
  onComplete: function(){
		let ret = level.current == null;
		// @expect(ret == true);
  }
});

register(condition, control, options)

Register level control
Parameters:
Name Type Description
condition String Query conditions (The level control will apply to query results)
control THING.BaseLevelControl The level control
options RegisterControlOptions The level control options
Source:

unregister(condition, tag)

Unregister level control
Parameters:
Name Type Description
condition String Query conditions
tag String The level control tag.
Source: