Giter Club home page Giter Club logo

oscript-component-example's Introduction

Как создать компонент для Односкрипта

  1. Создаём новый проект-библиотеку

  2. Подключаем NuGet пакеты "OneScript" и "OneScript.StandardLibrary" верси 2.0.0 и выше. Первый подключать обязательно, второй подключается для возможности использования встроенных типов Массив, ТаблицаЗначений и т.д.

  3. Подключаем модули:

    using ScriptEngine.Machine.Contexts;
    using ScriptEngine.Machine;
    using OneScript.StandardLibrary; // только если подключили OneScript.StandardLibrary
    
  4. Ставим на класс пометку [ContextClass("МойКласс", "MyClass")] и добавляем классу наследование от AutoContext<MyClass>

  5. Прописываем в класс конструктор

    [ScriptConstructor]
    public static MyClass Constructor()
    {
        return new MyClass();
    }
    
  6. После чего в коде можно использовать вызов вида

    ПодключитьВнешнююКомпоненту("oscript-component/bin/Debug/net6.0/oscript-component.dll");
    ОбъектМоегоКласса = Новый МойКласс;
    

oscript-component-example's People

Contributors

ava57r avatar dependabot[bot] avatar dmpas avatar nixel2007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

oscript-component-example's Issues

Версия движка выше 1.0.16

Как только поднимаю OneScript.StandardLibrary до 1.0.17. Падают тесты с

NUnitTests.MainTestClass.TestAsInternalCollection

OneTimeSetUp: System.NullReferenceException : Ссылка на объект не указывает на экземпляр объекта.
  Exception doesn't have a stacktrace

Подробное описание в вики

  • Структура решения: какой проект для чего предназначен
  • Как отлаживать компоненту
  • Как писать внутренние и внешние тесты
  • Пара слов про Travis и Appveyor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.