nvidia-ace-ue-渲染器适配器

默认

rootGet

root GET 调用 返回: dict: 应用标题


/

用法和 SDK 示例

curl -X GET \
 -H "Accept: application/json" \
 "https://127.0.0.1/"
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();

        try {
            oas_any_type_not_mapped result = apiInstance.rootGet();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#rootGet");
            e.printStackTrace();
        }
    }
}
import 'package:openapi/api.dart';

final api_instance = DefaultApi();


try {
    final result = await api_instance.rootGet();
    print(result);
} catch (e) {
    print('Exception when calling DefaultApi->rootGet: $e\n');
}

import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();

        try {
            oas_any_type_not_mapped result = apiInstance.rootGet();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#rootGet");
            e.printStackTrace();
        }
    }
}


// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];

// Root
[apiInstance rootGetWithCompletionHandler: 
              ^(oas_any_type_not_mapped output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var NvidiaAceUeRendererAdapter = require('nvidia_ace_ue_renderer_adapter');

// Create an instance of the API class
var api = new NvidiaAceUeRendererAdapter.DefaultApi()
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.rootGet(callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class rootGetExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();

            try {
                // Root
                oas_any_type_not_mapped result = apiInstance.rootGet();
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.rootGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();

try {
    $result = $api_instance->rootGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->rootGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();

eval {
    my $result = $api_instance->rootGet();
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->rootGet: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()

try:
    # Root
    api_response = api_instance.root_get()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->rootGet: %s\n" % e)
extern crate DefaultApi;

pub fn main() {

    let mut context = DefaultApi::Context::default();
    let result = client.rootGet(&context).wait();

    println!("{:?}", result);
}

作用域

参数

响应


Ue

createConnectionUePost

创建连接

初始化 WebRTC 连接到 VST 参数: connection (WebRTCConnection): 建立 WebRTC 连接所需的必要信息 返回: ConnectedClientId: 与给定 connection_id 关联的已连接客户端信息


/ue/

用法和 SDK 示例

curl -X POST \
 -H "Accept: application/json" \
 -H "Content-Type: application/json" \
 "https://127.0.0.1/ue/" \
 -d '{
  "stream_id" : "stream_id",
  "ws_port" : 39501,
  "ip" : "ip",
  "udp_port" : 5249,
  "streamer_id" : "streamer_id",
  "webrtc_vendor" : "webrtc_vendor"
}'
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.UeApi;

import java.io.File;
import java.util.*;

public class UeApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        UeApi apiInstance = new UeApi();
        WebRTCConnection webRTCConnection = ; // WebRTCConnection | 

        try {
            ConnectedClientId result = apiInstance.createConnectionUePost(webRTCConnection);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UeApi#createConnectionUePost");
            e.printStackTrace();
        }
    }
}
import 'package:openapi/api.dart';

final api_instance = DefaultApi();

final WebRTCConnection webRTCConnection = new WebRTCConnection(); // WebRTCConnection | 

try {
    final result = await api_instance.createConnectionUePost(webRTCConnection);
    print(result);
} catch (e) {
    print('Exception when calling DefaultApi->createConnectionUePost: $e\n');
}

import org.openapitools.client.api.UeApi;

public class UeApiExample {
    public static void main(String[] args) {
        UeApi apiInstance = new UeApi();
        WebRTCConnection webRTCConnection = ; // WebRTCConnection | 

        try {
            ConnectedClientId result = apiInstance.createConnectionUePost(webRTCConnection);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UeApi#createConnectionUePost");
            e.printStackTrace();
        }
    }
}


// Create an instance of the API class
UeApi *apiInstance = [[UeApi alloc] init];
WebRTCConnection *webRTCConnection = ; // 

// Create Connection
[apiInstance createConnectionUePostWith:webRTCConnection
              completionHandler: ^(ConnectedClientId output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var NvidiaAceUeRendererAdapter = require('nvidia_ace_ue_renderer_adapter');

// Create an instance of the API class
var api = new NvidiaAceUeRendererAdapter.UeApi()
var webRTCConnection = ; // {WebRTCConnection} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.createConnectionUePost(webRTCConnection, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class createConnectionUePostExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new UeApi();
            var webRTCConnection = new WebRTCConnection(); // WebRTCConnection | 

            try {
                // Create Connection
                ConnectedClientId result = apiInstance.createConnectionUePost(webRTCConnection);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling UeApi.createConnectionUePost: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\UeApi();
$webRTCConnection = ; // WebRTCConnection | 

try {
    $result = $api_instance->createConnectionUePost($webRTCConnection);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UeApi->createConnectionUePost: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::UeApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::UeApi->new();
my $webRTCConnection = WWW::OPenAPIClient::Object::WebRTCConnection->new(); # WebRTCConnection | 

eval {
    my $result = $api_instance->createConnectionUePost(webRTCConnection => $webRTCConnection);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling UeApi->createConnectionUePost: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.UeApi()
webRTCConnection =  # WebRTCConnection | 

try:
    # Create Connection
    api_response = api_instance.create_connection_ue_post(webRTCConnection)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UeApi->createConnectionUePost: %s\n" % e)
extern crate UeApi;

pub fn main() {
    let webRTCConnection = ; // WebRTCConnection

    let mut context = UeApi::Context::default();
    let result = client.createConnectionUePost(webRTCConnection, &context).wait();

    println!("{:?}", result);
}

作用域

参数

请求体参数
名称 描述
webRTCConnection *

响应


deleteConnectionUeConnectionIdDelete

删除连接

_summary_ 参数: connection_id (Annotated[str, Path, optional): _description_. 默认为 "The connection id", max_length=128)]. 返回: JSON: _description_


/ue/{connection_id}

用法和 SDK 示例

curl -X DELETE \
 -H "Accept: application/json" \
 "https://127.0.0.1/ue/{connection_id}"
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.UeApi;

import java.io.File;
import java.util.*;

public class UeApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        UeApi apiInstance = new UeApi();
        String connectionId = connectionId_example; // String | 

        try {
            oas_any_type_not_mapped result = apiInstance.deleteConnectionUeConnectionIdDelete(connectionId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UeApi#deleteConnectionUeConnectionIdDelete");
            e.printStackTrace();
        }
    }
}
import 'package:openapi/api.dart';

final api_instance = DefaultApi();

final String connectionId = new String(); // String | 

try {
    final result = await api_instance.deleteConnectionUeConnectionIdDelete(connectionId);
    print(result);
} catch (e) {
    print('Exception when calling DefaultApi->deleteConnectionUeConnectionIdDelete: $e\n');
}

import org.openapitools.client.api.UeApi;

public class UeApiExample {
    public static void main(String[] args) {
        UeApi apiInstance = new UeApi();
        String connectionId = connectionId_example; // String | 

        try {
            oas_any_type_not_mapped result = apiInstance.deleteConnectionUeConnectionIdDelete(connectionId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UeApi#deleteConnectionUeConnectionIdDelete");
            e.printStackTrace();
        }
    }
}


// Create an instance of the API class
UeApi *apiInstance = [[UeApi alloc] init];
String *connectionId = connectionId_example; //  (default to null)

// Delete Connection
[apiInstance deleteConnectionUeConnectionIdDeleteWith:connectionId
              completionHandler: ^(oas_any_type_not_mapped output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var NvidiaAceUeRendererAdapter = require('nvidia_ace_ue_renderer_adapter');

// Create an instance of the API class
var api = new NvidiaAceUeRendererAdapter.UeApi()
var connectionId = connectionId_example; // {String} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.deleteConnectionUeConnectionIdDelete(connectionId, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class deleteConnectionUeConnectionIdDeleteExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new UeApi();
            var connectionId = connectionId_example;  // String |  (default to null)

            try {
                // Delete Connection
                oas_any_type_not_mapped result = apiInstance.deleteConnectionUeConnectionIdDelete(connectionId);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling UeApi.deleteConnectionUeConnectionIdDelete: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\UeApi();
$connectionId = connectionId_example; // String | 

try {
    $result = $api_instance->deleteConnectionUeConnectionIdDelete($connectionId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UeApi->deleteConnectionUeConnectionIdDelete: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::UeApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::UeApi->new();
my $connectionId = connectionId_example; # String | 

eval {
    my $result = $api_instance->deleteConnectionUeConnectionIdDelete(connectionId => $connectionId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling UeApi->deleteConnectionUeConnectionIdDelete: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.UeApi()
connectionId = connectionId_example # String |  (default to null)

try:
    # Delete Connection
    api_response = api_instance.delete_connection_ue_connection_id_delete(connectionId)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UeApi->deleteConnectionUeConnectionIdDelete: %s\n" % e)
extern crate UeApi;

pub fn main() {
    let connectionId = connectionId_example; // String

    let mut context = UeApi::Context::default();
    let result = client.deleteConnectionUeConnectionIdDelete(connectionId, &context).wait();

    println!("{:?}", result);
}

作用域

参数

路径参数
名称 描述
connection_id*
字符串
必需

响应


getConnectionUeConnectionIdGet

获取连接

_summary_ 参数: connection_id (Annotated[str, Path, optional): _description_. 默认为 "The connection id", max_length=128)]. 返回: _type_: _description_


/ue/{connection_id}

用法和 SDK 示例

curl -X GET \
 -H "Accept: application/json" \
 "https://127.0.0.1/ue/{connection_id}"
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.UeApi;

import java.io.File;
import java.util.*;

public class UeApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        UeApi apiInstance = new UeApi();
        String connectionId = connectionId_example; // String | 

        try {
            ConnectedClientId result = apiInstance.getConnectionUeConnectionIdGet(connectionId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UeApi#getConnectionUeConnectionIdGet");
            e.printStackTrace();
        }
    }
}
import 'package:openapi/api.dart';

final api_instance = DefaultApi();

final String connectionId = new String(); // String | 

try {
    final result = await api_instance.getConnectionUeConnectionIdGet(connectionId);
    print(result);
} catch (e) {
    print('Exception when calling DefaultApi->getConnectionUeConnectionIdGet: $e\n');
}

import org.openapitools.client.api.UeApi;

public class UeApiExample {
    public static void main(String[] args) {
        UeApi apiInstance = new UeApi();
        String connectionId = connectionId_example; // String | 

        try {
            ConnectedClientId result = apiInstance.getConnectionUeConnectionIdGet(connectionId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UeApi#getConnectionUeConnectionIdGet");
            e.printStackTrace();
        }
    }
}


// Create an instance of the API class
UeApi *apiInstance = [[UeApi alloc] init];
String *connectionId = connectionId_example; //  (default to null)

// Get Connection
[apiInstance getConnectionUeConnectionIdGetWith:connectionId
              completionHandler: ^(ConnectedClientId output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var NvidiaAceUeRendererAdapter = require('nvidia_ace_ue_renderer_adapter');

// Create an instance of the API class
var api = new NvidiaAceUeRendererAdapter.UeApi()
var connectionId = connectionId_example; // {String} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getConnectionUeConnectionIdGet(connectionId, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class getConnectionUeConnectionIdGetExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new UeApi();
            var connectionId = connectionId_example;  // String |  (default to null)

            try {
                // Get Connection
                ConnectedClientId result = apiInstance.getConnectionUeConnectionIdGet(connectionId);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling UeApi.getConnectionUeConnectionIdGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\UeApi();
$connectionId = connectionId_example; // String | 

try {
    $result = $api_instance->getConnectionUeConnectionIdGet($connectionId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UeApi->getConnectionUeConnectionIdGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::UeApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::UeApi->new();
my $connectionId = connectionId_example; # String | 

eval {
    my $result = $api_instance->getConnectionUeConnectionIdGet(connectionId => $connectionId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling UeApi->getConnectionUeConnectionIdGet: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.UeApi()
connectionId = connectionId_example # String |  (default to null)

try:
    # Get Connection
    api_response = api_instance.get_connection_ue_connection_id_get(connectionId)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UeApi->getConnectionUeConnectionIdGet: %s\n" % e)
extern crate UeApi;

pub fn main() {
    let connectionId = connectionId_example; // String

    let mut context = UeApi::Context::default();
    let result = client.getConnectionUeConnectionIdGet(connectionId, &context).wait();

    println!("{:?}", result);
}

作用域

参数

路径参数
名称 描述
connection_id*
字符串
必需

响应


. if (typeof options.insertAt === "undefined") options.insertAt = "bottom"; var styles = listToStyles(list); addStylesToDom(styles, options); return function update(newList) { var mayRemove = []; for(var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; domStyle.refs--; mayRemove.push(domStyle); } if(newList) { var newStyles = listToStyles(newList); addStylesToDom(newStyles, options); } for(var i = 0; i < mayRemove.length; i++) { var domStyle = mayRemove[i]; if(domStyle.refs === 0) { for(var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); delete stylesInDom[domStyle.id]; } } }; } function addStylesToDom(styles, options) { for(var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; if(domStyle) { domStyle.refs++; for(var j = 0; j < domStyle.parts.length; j++) { domStyle.parts[j](item.parts[j]); } for(; j < item.parts.length; j++) { domStyle.parts.push(addStyle(item.parts[j], options)); } } else { var parts = []; for(var j = 0; j < item.parts.length; j++) { parts.push(addStyle(item.parts[j], options)); } stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; } } } function listToStyles(list) { var styles = []; var newStyles = {}; for(var i = 0; i < list.length; i++) { var item = list[i]; var id = item[0]; var css = item[1]; var media = item[2]; var sourceMap = item[3]; var part = {css: css, media: media, sourceMap: sourceMap}; if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]}); else newStyles[id].parts.push(part); } return styles; } function insertStyleElement(options, styleElement) { var head = getHeadElement(); var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1]; if (options.insertAt === "top") { if(!lastStyleElementInsertedAtTop) { head.insertBefore(styleElement, head.firstChild); } else if(lastStyleElementInsertedAtTop.nextSibling) { head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling); } else { head.appendChild(styleElement); } styleElementsInsertedAtTop.push(styleElement); } else if (options.insertAt === "bottom") { head.appendChild(styleElement); } else { throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'."); } } function removeStyleElement(styleElement) { styleElement.parentNode.removeChild(styleElement); var idx = styleElementsInsertedAtTop.indexOf(styleElement); if(idx >= 0) { styleElementsInsertedAtTop.splice(idx, 1); } } function createStyleElement(options) { var styleElement = document.createElement("style"); styleElement.type = "text/css"; insertStyleElement(options, styleElement); return styleElement; } function createLinkElement(options) { var linkElement = document.createElement("link"); linkElement.rel = "stylesheet"; insertStyleElement(options, linkElement); return linkElement; } function addStyle(obj, options) { var styleElement, update, remove; if (options.singleton) { var styleIndex = singletonCounter++; styleElement = singletonElement || (singletonElement = createStyleElement(options)); update = applyToSingletonTag.bind(null, styleElement, styleIndex, false); remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true); } else if(obj.sourceMap && typeof URL === "function" && typeof URL.createObjectURL === "function" && typeof URL.revokeObjectURL === "function" && typeof Blob === "function" && typeof btoa === "function") { styleElement = createLinkElement(options); update = updateLink.bind(null, styleElement); remove = function() { removeStyleElement(styleElement); if(styleElement.href) URL.revokeObjectURL(styleElement.href); }; } else { styleElement = createStyleElement(options); update = applyToTag.bind(null, styleElement); remove = function() { removeStyleElement(styleElement); }; } update(obj); return function updateStyle(newObj) { if(newObj) { if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) return; update(obj = newObj); } else { remove(); } }; } var replaceText = (function () { var textStore = []; return function (index, replacement) { textStore[index] = replacement; return textStore.filter(Boolean).join('\n'); }; })(); function applyToSingletonTag(styleElement, index, remove, obj) { var css = remove ? "" : obj.css; if (styleElement.styleSheet) { styleElement.styleSheet.cssText = replaceText(index, css); } else { var cssNode = document.createTextNode(css); var childNodes = styleElement.childNodes; if (childNodes[index]) styleElement.removeChild(childNodes[index]); if (childNodes.length) { styleElement.insertBefore(cssNode, childNodes[index]); } else { styleElement.appendChild(cssNode); } } } function applyToTag(styleElement, obj) { var css = obj.css; var media = obj.media; if(media) { styleElement.setAttribute("media", media) } if(styleElement.styleSheet) { styleElement.styleSheet.cssText = css; } else { while(styleElement.firstChild) { styleElement.removeChild(styleElement.firstChild); } styleElement.appendChild(document.createTextNode(css)); } } function updateLink(linkElement, obj) { var css = obj.css; var sourceMap = obj.sourceMap; if(sourceMap) { // https://mdn.org.cn/en/docs/Web/API/WindowBase64/Base64_encoding_and_decoding css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; } var blob = new Blob([css], { type: "text/css" }); var oldSrc = linkElement.href; linkElement.href = URL.createObjectURL(blob); if(oldSrc) URL.revokeObjectURL(oldSrc); } /***/ }, /* 6 */ /***/ function(module, exports) { "use strict"; /* * Escapes `"` characters from string */ function escapeString(str) { return str.replace('"', '\"'); } /* * Determines if a value is an object */ function isObject(value) { var type = typeof value; return !!value && (type == 'object'); } exports.isObject = isObject; /* * Gets constructor name of an object. * */ function getObjectName(object) { if (object === undefined) { return ''; } if (object === null || (typeof object === 'object' && !object.constructor)) { return 'Object'; } var funcNameRegex = /function ([^(]*)/; var results = (funcNameRegex).exec((object).constructor.toString()); if (results && results.length > 1) { return results[1]; } else { return ''; } } exports.getObjectName = getObjectName; /* * Gets type of an object. Returns "null" for null objects */ function getType(object) { if (object === null) { return 'null'; } return typeof object; } exports.getType = getType; /* * Generates inline preview for a JavaScript object based on a value */ function getValuePreview(object, value) { var type = getType(object); if (type === 'null' || type === 'undefined') { return type; } if (type === 'string') { value = '"' + escapeString(value) + '"'; } if (type === 'function') { // Remove content of the function return object.toString() .replace(/[\r\n]/g, '') .replace(/\{.*\}/, '') + '{…}'; } return value; } exports.getValuePreview = getValuePreview; /* * Generates inline preview for a JavaScript object */ function getPreview(object) { var value = ''; if (isObject(object)) { value = getObjectName(object); if (Array.isArray(object)) value += '[' + object.length + ']'; } else { value = getValuePreview(object, object); } return value; } exports.getPreview = getPreview; /* * Generates a prefixed CSS class name */ function cssClass(className) { return "json-formatter-" + className; } exports.cssClass = cssClass; /* * Creates a new DOM element with given type and class * TODO: move me to helpers */ function createElement(type, className, content) { var el = document.createElement(type); if (className) { el.classList.add(cssClass(className)); } if (content !== undefined) { if (content instanceof Node) { el.appendChild(content); } else { el.appendChild(document.createTextNode(String(content))); } } return el; } exports.createElement = createElement; /***/ } /******/ ]) }); ; //# sourceMappingURL=json-formatter.js.map