Bridge 正在参加 2021 年度 OSC 中国开源项目评选,请投票支持!
Bridge 在 2021 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
2021 年度 OSC 中国开源项目评选 正在火热进行中,快来投票支持你喜欢的开源项目!
2021 年度 OSC 中国开源项目评选 >>> 中场回顾
Bridge 获得 2021 年度 OSC 中国开源项目评选「最佳人气项目」 !

软件简介

Bridge.NET logo

Build status Build Status NuGet Status Join the chat at https://gitter.im/bridgedotnet/Bridge

Bridge.NET is an open source C#-to-JavaScript Compiler. Write your application in C# and run on billions of devices.

Write in C#. Run in a Web Browser.

C#JavaScript
public class Program
{
    public static void Main()
    {
        var msg = "Hello, World!";
        Console.WriteLine(msg);
    }

}

Bridge.define("Demo.Program", {
    main: function Main () {
        var msg = "Hello, World!";
        System.Console.WriteLine(msg);
    }

});

Run the sample above at Deck.NET.

TL;DR

Getting Started

A great place to start if you're new to Bridge is reviewing the Getting Started wiki.

The easiest place to see Bridge in action is Deck.NET.

Video Tutorial

Sample

The following code sample demonstrates a simple App.cs class that will run automatically on page load and write a message to the Bridge Console.

Example (Deck)

public class Program
{
    public static void Main()
    {
        Console.WriteLine("Hello World!");
    }
}

The C# class above will be compiled into JavaScript and added to /Bridge/ouput/demo.js within your project. By default, Bridge will use the Namespace name as the file name. In this case: demo.js. There are many options to control the output of your JavaScript files, and the Attribute Reference is important documentation to review.

Bridge.define("Demo.Program", {
    main: function Main() {
        System.Console.WriteLine("Hello World!");
    }
});

Installation

A full list of installation options available at bridge.net/download/, including full support for Visual Studio and Visual Studio Community on Windows, and Visual Studio Mac.

Bridge for Visual Studio

If you're using Visual Studio for Windows, the easiest way to get started is by adding the Bridge.NET for Visual Studio extension.

From within Visual Studio, go to the Tools > Extensions and Updates....

Bridge for Visual Studio

From the options on the left side, be sure to select Online, then search for Bridge. Clicking Download will install Bridge for Visual Studio. After installation is complete, Visual Studio may require a restart.

Visual Studio Extensions and Updates

Once installation is complete you will have a new Bridge.NET project type. When creating new Bridge enabled projects, select this project type.

NuGet

Another option is installation of Bridge into a new C# Class Library project using NuGet. Within the NuGet Package Manager, search for Bridge and click to install.

Bridge can also be installed using the NuGet Command Line tool by running the following command:

Install-Package Bridge

More information regarding Nuget package installation for Bridge is available in the Documentation.

Contributing

Interested in contributing to Bridge? Please see CONTRIBUTING.md.

We also flag some Issues as up-for-grabs. These are generally easy introductions to the inner workings of Bridge, and are items we just haven't had time to implement. Your help is always appreciated.

Badges

Show your support by adding a built with Bridge.NET badge to your projects README or website.

Built with Bridge.NET

Markdown

[![Built with Bridge.NET](https://img.shields.io/badge/built%20with-Bridge.NET-blue.svg)](http://bridge.net/)

HTML

<a href="http://bridge.net/">
    <img src="https://img.shields.io/badge/built%20with-Bridge.NET-blue.svg" title="Built with Bridge.NET" />
</a>

How to Help

We need your help spreading the word about Bridge. Any of the following items will help:

  1. Star the Bridge project on GitHub
  2. Add a Badge
  3. Leave a review at Visual Studio Gallery
  4. Blog about Bridge.NET
  5. Tweet about @bridgedotnet
  6. Start a discussion on Reddit or Hacker News
  7. Answer Bridge related questions on StackOverflow
  8. Give a local usergroup presentation on Bridge
  9. Give a conference talk on Bridge
  10. Provide feedback (forums, GitHub or email)

Testing

Bridge is continually tested with the full test runner available at http://testing.bridge.net/.

Credits

Bridge is developed by the team at Object.NET. Frameworks and Tools for .NET Developers.

License

Apache License, Version 2.0

Please see LICENSE for details.

展开阅读全文

代码

评论 (0)

加载中
更多评论
暂无内容
发表了博客
2015/12/30 13:51

__bridge,__bridge_ retained,__bridge_ transfer

Core Foundation 框架 Core Foundation框架 (CoreFoundation.framework) 是一组C语言接口,它们为iOS应用程序提供基本数据管理和服务功能。下面列举该框架支持进行管理的数据以及可提供的服务: 群体数据类型 (数组、集合等) 程序包 字符串管理 日期和时间管理 原始数据块管理 偏好管理 URL及数据流操作 线程和RunLoop 端口和soket通讯 Core Foundation框架和Foundation框架紧密相关,它们为相同功能提供接口,但Foundation框架...

0
0
发表了博客
2015/11/24 06:57

ARC中__bridge, __bridge__transfer, __bridge_retaine

多数情况下,Objective-C 对象和 Core Foundation 对象之间互相转换时, 我们都应该使用__bridge。但是有时候我们确实需要给予 ARC 某个对象的所有权, 或者解除 ARC 对某个对象的所有权。这种情况下我们就需要使用另外两种 bridging casts: __bridge_transfer:给予 ARC 所有权 __bridge_retained:解除 ARC 所有权 一旦 (__bridge_retained CFStringRef) 转换完成,ARC 就不再负责释放该 对象。如果你在这里使用 __bridge,应用就很可...

0
1
发表了博客
2013/07/02 18:37

__bridge,__bridge_retained和__bridge_transfer的区别与使用

__bridge只做类型转换,但是不修改对象(内存)管理权; __bridge_retained(也可以使用CFBridgingRetain)将Objective-C的对象转换为Core Foundation的对象,同时将对象(内存)的管理权交给我们,后续需要使用CFRelease或者相关方法来释放对象; __bridge_transfer(也可以使用CFBridgingRelease)将Core Foundation的对象转换为Objective-C的对象,同时将对象(内存)的管理权交给ARC。...

0
2
发表了博客
2014/06/25 11:31

ARC中__bridge, __bridge__transfer, __bridge_retained 关系

转在开头:转在这篇文章是因为我遇到一个问题,这篇文章解决了我这个问题,debug:cast of objective- c pointer type 'NSMutableDictionary *' to C pointer ----——同时向此文的原作者致敬! 总结于 IOS Tuturial 中 ARC两章,详细在dropbox pdf 文档。 Toll-Free Bridging 当你在 Objective-C 和 Core Foundation 对象之间进行转换时,就需要使用 Bridge cast。 今天的多数应用很少需要使用 Core Foundation,大多数工作都可以...

0
0
2020/04/14 16:26

Bridge桥接

现实和抽象分离开来,使用bridge桥接

0
0
发表了博客
2013/02/01 13:09

Bridge Pattern

http://www.cnblogs.com/hegezhou_hot/archive/2010/12/10/1902185.html 桥接模式的主要目的是将一个对象的变化因素抽象出来,不是通过类继承的方式来满足这个因素的变化,而是通过对象组合的方式来依赖因素的抽象,这样当依赖的因素的具体实现发生变化后,而我们的具体的引用却不用发生改变,因为我们的对象是依赖于抽象的,而不是具体的实现。

0
0
发表了博客
2020/06/20 14:49

Linux bridge模块的一次重构(让bridge归bridge让eth0归eth0)

勾起了回忆,就想记录点什么。 再看刘经理的需求: 被bonding的eth0可以独立工作,eth0作为类似带内管理接口。 当然,现在看来,用macvlan实现这个非常容易: ip link add link eth0 man0 type macvlan brctl addbr br0 brctl addif br0 man0 brctl addif br0 eth1 ifconfig br0 1.1.1.1/8 up ifconfig man0 4.4.4.4/8 up OK,现在经理可以通过eth0来作为管理口访问管理地址4.4.4.4了,而eth0同时也和eth1一起作为br0的port存在...

0
0
没有更多内容
加载失败,请刷新页面
点击加载更多
加载中
下一页
暂无内容
0 评论
0 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部