js_wrapping_generator 0.4.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 1

Dart Js Wrapping generator

A generator of Js wrappers. See js_wrapping package for details.

See CHANGELOG of the js_wrapping package for details.

example/example.dart

// Copyright (c) 2015, Alexandre Ardhuin. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.

@JsName('z.y.x')
library js_wrapping_generator.example.js_proxy;

import 'package:js_wrapping/js_wrapping.dart';
import 'package:js_wrapping/util/state.dart';

part 'example.g.dart';

abstract class _JsFoo implements JsInterface {
  static int get static1 => $js;
  static int static2;
  static int staticMethod(JsFoo foo) => $js;

  factory _JsFoo() => null;

  List l1;
  List<num> l2;
  List<JsFoo> l3;

  @JsName('_i')
  int i;

  @JsName('k')
  num k1, k2;
  int j = null;
  bool get l;

  String get a;
  void set a(String a);

  String get b => '';
  void set b(String b) {}

  m1();
  void m2();
  String m3();
  String m4(int a);
  int m5(int a, b);
  @JsName('_m6')
  int _m6(int a, b);
}

callM6(JsFoo foo) => foo._m6(1, 2);

@JsName('a.b.JsBar')
abstract class _JsBar extends JsInterface {
  _JsBar.created(JsObject o) : super.created(o) {
    getState(this).putIfAbsent(#a, () => 0);
  }

  factory _JsBar() = dynamic;
  factory _JsBar.named(int x, int y) = dynamic;

  JsBar m1();

  void set a(int a) {
    getState(this)[#a] = a;
  }

  int get a => getState(this)[#a] as int;
}

abstract class _JsBaz extends JsBar {
  factory _JsBaz() = dynamic;
}

abstract class __Context implements JsInterface {
  int find(String a);

  String a;

  String get b;

  set b(String b1);
}

final _context = new _Context.created(context);

final find = _context.find;
String get a => _context.a;
void set a(String _a) {
  _context.a = _a;
}

String get b => _context.b;
void set b(String _b) {
  _context.b = _b;
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  js_wrapping_generator: ^0.4.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:js_wrapping_generator/js_interface_creator.dart';
import 'package:js_wrapping_generator/js_interface_generator.dart';
import 'package:js_wrapping_generator/util.dart';
  
Version Uploaded Documentation Archive
0.5.0 Jul 27, 2018 Go to the documentation of js_wrapping_generator 0.5.0 Download js_wrapping_generator 0.5.0 archive
0.4.9 Jul 6, 2018 Go to the documentation of js_wrapping_generator 0.4.9 Download js_wrapping_generator 0.4.9 archive
0.4.8 Jun 26, 2018 Go to the documentation of js_wrapping_generator 0.4.8 Download js_wrapping_generator 0.4.8 archive
0.4.7 Apr 13, 2018 Go to the documentation of js_wrapping_generator 0.4.7 Download js_wrapping_generator 0.4.7 archive
0.4.6 Apr 13, 2018 Go to the documentation of js_wrapping_generator 0.4.6 Download js_wrapping_generator 0.4.6 archive
0.4.5 Apr 7, 2018 Go to the documentation of js_wrapping_generator 0.4.5 Download js_wrapping_generator 0.4.5 archive
0.4.4 Apr 6, 2018 Go to the documentation of js_wrapping_generator 0.4.4 Download js_wrapping_generator 0.4.4 archive
0.4.2 Aug 30, 2017 Go to the documentation of js_wrapping_generator 0.4.2 Download js_wrapping_generator 0.4.2 archive
0.4.1 Aug 28, 2017 Go to the documentation of js_wrapping_generator 0.4.1 Download js_wrapping_generator 0.4.1 archive
0.4.0 Jun 20, 2017 Go to the documentation of js_wrapping_generator 0.4.0 Download js_wrapping_generator 0.4.0 archive

All 15 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
3
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
1
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.22.1 <2.0.0