Skip to content

A library that makes it easier to run a mod dependent on other mods

License

Notifications You must be signed in to change notification settings

Wolf-Team/CheckDeps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CheckDeps

en | ru

Usage

Write in your launch-file

IMPORT("CheckDeps");

new CheckDeps()
	//The entire API will be available under the API name.
	.add("name_api") 
	// Add a dependency with a custom callback. The return value of the callback will be available under the API name.
	.add("name_api_2", function (api) {
		return api.something;
	}) 
	// Add a dependency with options.
	.add("name_api_3", {
		/**
		 * Required dependency. If this API has not been loaded, the mod will not run.
		 * Optional parameter.
		 * Default: true
		 */
		required: false,
		/**
		 * Callback on successful loading of the API. The return value of the callback will be available under the API name.
		 * Optional parameter.
		 * Default: function (api) { return api }
		 */
		callback: function (api) {
			return api;
		},
		/**
		 * Callback if the API has not been loaded. The return value of the callback will be available under the API name.
		 * Optional parameter.
		 */
		fallback: function(){
			return {
				/* My scope */
				a:12
			}
		}
	})
	//Launch mod with builded scope
	.launch(function(scope){ Launch(scope); });

You can use CheckDeps without keyword new. You can pass the URL to the dependency information page to the CheckDeps constructor.

CheckDeps("https://github.com/Wolf-Team/CheckDeps")
	.launch(function(scope){ Launch(scope); });

About

A library that makes it easier to run a mod dependent on other mods

Resources

License

Stars

Watchers

Forks