mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-27 22:35:23 +08:00
This adds the typings for Freedom that we have been using internally (https://github.com/uProxy/uproxy-lib/tree/dev/third_party/freedom-typings) There is the main file with all the actual typings and then two extra files around it that handle the existence of a variable named freedom in two different environments. The intention is that only one of these would be included in a given build environment. I listed myself as the author for this version of the typings. In reality, they were created by various members of the uProxy team over a long period of time.
25 lines
753 B
TypeScript
25 lines
753 B
TypeScript
/// <reference path="../es6-promise/es6-promise.d.ts"/>
|
|
/// <reference path="freedom.d.ts" />
|
|
|
|
var freedomModule :freedom.FreedomInModuleEnv;
|
|
var freedomCore :freedom.FreedomInCoreEnv;
|
|
|
|
var parentModule :freedom.ParentModuleThing = freedomModule();
|
|
parentModule.on('message', (x :string) => {
|
|
});
|
|
|
|
var coreInModule :freedom.Core = freedomModule['core']();
|
|
coreInModule.getLogger('tag').then((logger :freedom.Logger) => {
|
|
logger.log('message');
|
|
});
|
|
|
|
var freedomConsole :freedom.Console.Console = freedomModule['core.console']();
|
|
var doneLogging :Promise<void> = freedomConsole.log('source', 'message');
|
|
|
|
freedomCore('freedom-module.json', {
|
|
'logger': 'loggingprovider.json',
|
|
'debug': 'log'
|
|
}).then((moduleFactory) => {
|
|
moduleFactory.close();
|
|
});
|