js_wrapping_generator 0.4.2

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

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;
}

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.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
0.3.0+1 Feb 20, 2017 Go to the documentation of js_wrapping_generator 0.3.0+1 Download js_wrapping_generator 0.3.0+1 archive
0.3.0 Nov 15, 2016 Go to the documentation of js_wrapping_generator 0.3.0 Download js_wrapping_generator 0.3.0 archive
0.0.3 Feb 4, 2014 Go to the documentation of js_wrapping_generator 0.0.3 Download js_wrapping_generator 0.0.3 archive
0.0.2 Dec 19, 2013 Go to the documentation of js_wrapping_generator 0.0.2 Download js_wrapping_generator 0.0.2 archive
0.0.1 Oct 12, 2013 Go to the documentation of js_wrapping_generator 0.0.1 Download js_wrapping_generator 0.0.1 archive

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
11 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
56

Platforms

Detected platforms: other

Platform components identified in package: build, io, mirrors.

Suggestions

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.22.1 <2.0.0
analyzer ^0.30.0+2 0.30.0+4 0.31.0+1
build ^0.10.0+1 0.10.2+1 0.12.0+1
build_runner ^0.4.0+3 0.4.0+3 0.7.9
js_wrapping 0.4.2 0.4.2
path ^1.4.2 1.5.1
source_gen ^0.7.1 0.7.4+3
Transitive dependencies
args 1.3.0
async 1.13.3 2.0.3
barback 0.15.2+14
build_barback 0.4.0+1 0.5.0+3
charcode 1.1.1
cli_util 0.1.2+1
code_transformers 0.5.1+4
collection 1.14.5
convert 2.0.1
crypto 2.0.2+1
csslib 0.14.1
dart_style 1.0.9+1
front_end 0.1.0-alpha.4.1 0.1.0-alpha.8
glob 1.1.5
html 0.13.2+2
http_parser 3.1.1
isolate 1.1.0
kernel 0.3.0-alpha.1.1 0.3.0-alpha.5
logging 0.11.3+1
meta 1.1.2
mime 0.9.6
package_config 1.0.3
plugin 0.2.0+2
pool 1.3.4
shelf 0.6.8 0.7.2
shelf_static 0.2.7
source_maps 0.10.4
source_span 1.4.0
stack_trace 1.9.1
stream_channel 1.6.3
stream_transform 0.0.10
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+7
yaml 2.1.13
Dev dependencies
browser ^0.10.0
test ^0.12.0