Catalog npm
PACKAGE EXPLORERView in registry

3dd-widget

npm

Compact API for 3DDashboard widget

3ddashboard3dexperienceenoviawrapper
Versions collected7
Direct dependencies4From release 0.3.4
Last observed20 Oct, 19:39 UTC

README

Current package documentation

3dd-widget

Compact API for 3DDashboard widget

This library offers straight convenient way to approach 3DEXPERIENCE web services via widget. What it does is:

  • performing authentication requests before accessing corresponding 3DEXPERIENCE services (right now, for 3DSpace and 3DSwym, but it's easy to extend);
  • providing abstract class Service with static request method;
  • retrieving URLs of required services and binding them to appropriate SV* classes, allowing you to make request by URI rather than full URL;
  • incrementing confidence in code you write with TypeScript support (everything has types and comments).

3dd-widget requires running in browser with ECMAScript 2015 support (good thing is that modern browsers support it).

Installation

Package requires Node.js. If it's installed, run:

$ npm install 3dd-widget

Plus this is very good to use it with bundler like Webpack, so everything's imported correctly.

Remember that you must export script as AMD module to work with global widget object in UWA frame. Though library does not need it for most things.

Example

import { Widget } from '3dd-widget';
import { SV3DSpace } from '3dd-widget/dist/services';

export default class extends Widget {
  constructor() {
    super({
      removeDefaultStyles: true
    });
    init();
  }

  async init() {
    widget.body.innerText = 'Hello World!';

    await Widget.fetchServices([SV3DSpace]);
    // If fail occured, next code will not run.

    // `await` keyword in `async` function returns resolved value from child Promise
    // Get projects as plain object:
    const projects = await SV3DSpace.get('/resources/v1/modeler/projects');
    console.log(projects);
  }
}

You also can implement custom class and extend from it:

// VueWidget.ts
import { Widget, Service } from '3dd-widget';
import Vue from 'vue';

export default class VueWidget extends Widget {
  constructor(App: typeof Vue, services: typeof Service[]) {
    super({
      removeDefaultStyles: true
    });
    new Vue({
      el: '.moduleContent',
      render: h => h(App)
    });
    Widget.fetchServices(services);
  }
}
// ChildWidget/index.ts
import { SV3DSpace } from '3dd-widget';
import VueWidget from '../VueWidget';
import App from './App.vue';

export default class ChildWidget extends VueWidget {
  constructor() {
    super(App, [SV3DSpace]);
  }
}

Extras

3dd-widget also provides TypeScript shims for perceiving modules starting with UWA, DS and RequireJS loader plugins as not part of Node.js modules, which essentially makes TypeScript compilation work with these. It implicates usage within 3DDashboard widget frame, of course. We only have DS/WAFData/WAFData almost fully declared.

Build

$ npm run build
# or
$ npx tsc

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 7

Collected releases
VersionPublishedDirect dependenciesOpen version
0.3.4Registry latest3 Sept 20204
0.3.33 Sept 20204
0.3.23 Sept 20204
0.3.13 Sept 20204
0.3.03 Sept 20204
0.2.010 Jun 20204
0.1.09 Jun 20204

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
vintprox/3dd-widget

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:39 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:1f6f54eded66c2563985fd5446b49db032d214aa9107f18017f927697fcbf76d