IA Unreal Renderer 微服务流 HTTP API

默认

sdrAddStreamPost

创建流

创建流


/sdr/add_stream

用法和 SDK 示例

curl -X POST \
 -H "Accept: application/json" \
 -H "Content-Type: application/json" \
 "https://127.0.0.1/sdr/add_stream" \
 -d ''
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();
        Sdr sdr = ; // Sdr | 

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

final api_instance = DefaultApi();

final Sdr sdr = new Sdr(); // Sdr | 

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

import org.openapitools.client.api.DefaultApi;

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

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


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

// Creates a stream
[apiInstance sdrAddStreamPostWith:sdr
              completionHandler: ^(defaultResponse output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var IaUnrealRendererMicroserviceStreamHttpApi = require('ia_unreal_renderer_microservice_stream_http_api');

// Create an instance of the API class
var api = new IaUnrealRendererMicroserviceStreamHttpApi.DefaultApi()
var sdr = ; // {Sdr} 

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

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

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

            try {
                // Creates a stream
                defaultResponse result = apiInstance.sdrAddStreamPost(sdr);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.sdrAddStreamPost: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

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

try {
    $result = $api_instance->sdrAddStreamPost($sdr);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->sdrAddStreamPost: ', $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();
my $sdr = WWW::OPenAPIClient::Object::Sdr->new(); # Sdr | 

eval {
    my $result = $api_instance->sdrAddStreamPost(sdr => $sdr);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->sdrAddStreamPost: $@\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()
sdr =  # Sdr | 

try:
    # Creates a stream
    api_response = api_instance.sdr_add_stream_post(sdr)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->sdrAddStreamPost: %s\n" % e)
extern crate DefaultApi;

pub fn main() {
    let sdr = ; // Sdr

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

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

作用域

参数

请求体参数
名称 描述
sdr *

SDR 请求的请求体

响应


sdrRemoveStreamPost

删除流

删除流


/sdr/remove_stream

用法和 SDK 示例

curl -X POST \
 -H "Accept: application/json" \
 -H "Content-Type: application/json" \
 "https://127.0.0.1/sdr/remove_stream" \
 -d ''
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();
        Sdr sdr = ; // Sdr | 

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

final api_instance = DefaultApi();

final Sdr sdr = new Sdr(); // Sdr | 

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

import org.openapitools.client.api.DefaultApi;

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

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


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

// Deletes a stream
[apiInstance sdrRemoveStreamPostWith:sdr
              completionHandler: ^(defaultResponse output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var IaUnrealRendererMicroserviceStreamHttpApi = require('ia_unreal_renderer_microservice_stream_http_api');

// Create an instance of the API class
var api = new IaUnrealRendererMicroserviceStreamHttpApi.DefaultApi()
var sdr = ; // {Sdr} 

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

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

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

            try {
                // Deletes a stream
                defaultResponse result = apiInstance.sdrRemoveStreamPost(sdr);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.sdrRemoveStreamPost: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

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

try {
    $result = $api_instance->sdrRemoveStreamPost($sdr);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->sdrRemoveStreamPost: ', $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();
my $sdr = WWW::OPenAPIClient::Object::Sdr->new(); # Sdr | 

eval {
    my $result = $api_instance->sdrRemoveStreamPost(sdr => $sdr);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->sdrRemoveStreamPost: $@\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()
sdr =  # Sdr | 

try:
    # Deletes a stream
    api_response = api_instance.sdr_remove_stream_post(sdr)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->sdrRemoveStreamPost: %s\n" % e)
extern crate DefaultApi;

pub fn main() {
    let sdr = ; // Sdr

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

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

作用域

参数

请求体参数
名称 描述
sdr *

SDR 请求的请求体

响应


streamsGet

读取当前流

读取当前流


/streams

用法和 SDK 示例

curl -X GET \
 -H "Accept: application/json" \
 "https://127.0.0.1/streams"
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 {
            defaultResponse result = apiInstance.streamsGet();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#streamsGet");
            e.printStackTrace();
        }
    }
}
import 'package:openapi/api.dart';

final api_instance = DefaultApi();


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

import org.openapitools.client.api.DefaultApi;

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

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


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

// Read the current stream
[apiInstance streamsGetWithCompletionHandler: 
              ^(defaultResponse output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var IaUnrealRendererMicroserviceStreamHttpApi = require('ia_unreal_renderer_microservice_stream_http_api');

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

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

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

            try {
                // Read the current stream
                defaultResponse result = apiInstance.streamsGet();
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.streamsGet: " + 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->streamsGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->streamsGet: ', $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->streamsGet();
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->streamsGet: $@\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:
    # Read the current stream
    api_response = api_instance.streams_get()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->streamsGet: %s\n" % e)
extern crate DefaultApi;

pub fn main() {

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

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

作用域

参数

响应


streamsStreamIdDelete

删除流

删除流


/streams/{stream_id}

用法和 SDK 示例

curl -X DELETE \
 -H "Accept: application/json" \
 "https://127.0.0.1/streams/{stream_id}"
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();
        String streamId = streamId_example; // String | 

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

final api_instance = DefaultApi();

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

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

import org.openapitools.client.api.DefaultApi;

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

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


// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *streamId = streamId_example; //  (default to null)

// Deletes a stream
[apiInstance streamsStreamIdDeleteWith:streamId
              completionHandler: ^(defaultResponse output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var IaUnrealRendererMicroserviceStreamHttpApi = require('ia_unreal_renderer_microservice_stream_http_api');

// Create an instance of the API class
var api = new IaUnrealRendererMicroserviceStreamHttpApi.DefaultApi()
var streamId = streamId_example; // {String} 

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

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

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var streamId = streamId_example;  // String |  (default to null)

            try {
                // Deletes a stream
                defaultResponse result = apiInstance.streamsStreamIdDelete(streamId);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.streamsStreamIdDelete: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

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

try {
    $result = $api_instance->streamsStreamIdDelete($streamId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->streamsStreamIdDelete: ', $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();
my $streamId = streamId_example; # String | 

eval {
    my $result = $api_instance->streamsStreamIdDelete(streamId => $streamId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->streamsStreamIdDelete: $@\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()
streamId = streamId_example # String |  (default to null)

try:
    # Deletes a stream
    api_response = api_instance.streams_stream_id_delete(streamId)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->streamsStreamIdDelete: %s\n" % e)
extern crate DefaultApi;

pub fn main() {
    let streamId = streamId_example; // String

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

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

作用域

参数

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

响应


streamsStreamIdPost

创建流

创建流


/streams/{stream_id}

用法和 SDK 示例

curl -X POST \
 -H "Accept: application/json" \
 "https://127.0.0.1/streams/{stream_id}"
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();
        String streamId = streamId_example; // String | 

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

final api_instance = DefaultApi();

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

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

import org.openapitools.client.api.DefaultApi;

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

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


// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *streamId = streamId_example; //  (default to null)

// Creates a stream
[apiInstance streamsStreamIdPostWith:streamId
              completionHandler: ^(defaultResponse output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var IaUnrealRendererMicroserviceStreamHttpApi = require('ia_unreal_renderer_microservice_stream_http_api');

// Create an instance of the API class
var api = new IaUnrealRendererMicroserviceStreamHttpApi.DefaultApi()
var streamId = streamId_example; // {String} 

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

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

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var streamId = streamId_example;  // String |  (default to null)

            try {
                // Creates a stream
                defaultResponse result = apiInstance.streamsStreamIdPost(streamId);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.streamsStreamIdPost: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

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

try {
    $result = $api_instance->streamsStreamIdPost($streamId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->streamsStreamIdPost: ', $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();
my $streamId = streamId_example; # String | 

eval {
    my $result = $api_instance->streamsStreamIdPost(streamId => $streamId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->streamsStreamIdPost: $@\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()
streamId = streamId_example # String |  (default to null)

try:
    # Creates a stream
    api_response = api_instance.streams_stream_id_post(streamId)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->streamsStreamIdPost: %s\n" % e)
extern crate DefaultApi;

pub fn main() {
    let streamId = streamId_example; // String

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

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

作用域

参数

路径参数
名称 描述
stream_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