js_wrapping_generator 0.5.0

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

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.5.0

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_wrapping_generator.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]
16
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

We analyzed this package on Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13+1

Platforms

Detected platforms: other

Primary library: package:js_wrapping_generator/js_wrapping_generator.dart with components: io, isolate, build, mirrors.

Health issues and suggestions

Document public APIs. (-0.60 points)

73 out of 74 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/js_wrapping_generator.dart. (-1 points)

Analysis of lib/js_wrapping_generator.dart reported 2 hints:

line 73 col 21: 'element' is deprecated and shouldn't be used.

line 555 col 47: 'bestElement' is deprecated and shouldn't be used.

Format lib/src/incremental_generator.dart.

Run dartfmt to format lib/src/incremental_generator.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.67.0 <3.0.0
analyzer ^0.32.3 0.32.6 0.35.1
build ^0.12.7 0.12.8 1.1.1
js_wrapping 0.5.0 0.5.0
path ^1.5.1 1.6.2
source_gen ^0.8.3 0.8.3+1 0.9.4+1
Transitive dependencies
args 1.5.1
async 2.0.8
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
csslib 0.14.6
dart_style 1.1.3 1.2.3
front_end 0.1.4+2 0.1.11
glob 1.1.7
html 0.13.3+3
kernel 0.3.4+2 0.3.11
logging 0.11.3+2
meta 1.1.7
package_config 1.0.5
plugin 0.2.0+3
source_span 1.5.4
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
utf 0.9.0+5
watcher 0.9.7+10
yaml 2.1.15
Dev dependencies
build_runner ^0.9.1
build_test ^0.10.2+5
test ^1.3.0